- char name[2048];
- int id = simgrid::s4u::this_actor::pid();
- snprintf(name, 2048, "%s%i", FILENAME1, id);
- simgrid::s4u::File* file = new simgrid::s4u::File(name, NULL);
- XBT_INFO("process %d is writing!", id);
- file->write(3000000);
- XBT_INFO("process %d goes to sleep for %d seconds", id, id);
- simgrid::s4u::this_actor::sleep_for(id);
- XBT_INFO("process %d is writing again!", id);
- file->write(3000000);
- XBT_INFO("process %d goes to sleep for %d seconds", id, 6 - id);
- simgrid::s4u::this_actor::sleep_for(6 - id);
- XBT_INFO("process %d is reading!", id);
- file->seek(0);
- file->read(3000000);
- XBT_INFO("process %d goes to sleep for %d seconds", id, id);
- simgrid::s4u::this_actor::sleep_for(id);
- XBT_INFO("process %d is reading again!", id);
- file->seek(0);
- file->read(3000000);
-
- XBT_INFO("process %d => Size of %s: %llu", id, name, file->size());
- // Close the file
- delete file;
+ const simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1
+ aid_t id = simgrid::s4u::this_actor::get_pid();
+ XBT_INFO("process %ld is writing!", id);
+ disk->write(4000000);
+ XBT_INFO("process %ld goes to sleep for %ld seconds", id, id);
+ simgrid::s4u::this_actor::sleep_for(static_cast<double>(id));
+ XBT_INFO("process %ld is writing again!", id);
+ disk->write(4000000);
+ XBT_INFO("process %ld goes to sleep for %ld seconds", id, 6 - id);
+ simgrid::s4u::this_actor::sleep_for(static_cast<double>(6 - id));
+ XBT_INFO("process %ld is reading!", id);
+ disk->read(4000000);
+ XBT_INFO("process %ld goes to sleep for %ld seconds", id, id);
+ simgrid::s4u::this_actor::sleep_for(static_cast<double>(id));
+ XBT_INFO("process %ld is reading again!", id);
+ disk->read(4000000);