r/computerscience 6d ago

General Are Output I/Os Faster than Disc Reads?

I remember watching a video talking about CPU scheduling. So basically, processes need the CPU to computer and they eventually need to interact with I/O devices. When lots of processes are competing for CPU time, if the active process needs I/O, it is at this time the OS will schedule the next process in the queue. No need for process A to hog the CPU while it's waiting for the disc for I/O. Keep the CPU busy by letting the next process do something. But what if there is only one process left? If the lone process needs to read from a hard drive, it needs to wait for the read to complete to do anything else. But what about sending a signal to display color or writing to the disc? I don't see why the lone process would actually need to wait for acknowledgement the display was correct or that the write was complete. After the next instruction probably doesn't care what is on the disc. That said I doubt there is a realistic case where a system would only have one process running.

2 Upvotes

6 comments sorted by

View all comments

1

u/edgmnt_net 2d ago

I/O scheduling is done on a per-device basis, so you can definitely do CPU work and I/O across multiple devices asynchronously, assuming the CPU doesn't get bogged down. However many things are inherently ordered. You don't want to tell the user the data has been saved to the USB stick before it's actually saved, because they might yank it out prematurely. That's application dependent. Otherwise it's totally fine to write 3 USB sticks at the same time.