Reputation: 1586
I was listening to OS lecture, and got confused by these two phrases.
I believed that a user process invokes system call to use the IO, the kernel executes the kernel instructions, while kernel is running user process waits until the IO process is finished. So I thought phrase 2 must be wrong. But professor said both are correct. Can someone help me understand why?
Upvotes: 0
Views: 383
Reputation: 21607
Actually, both are only correct sometimes.
"When a user process calls IO, it invokes a system call and waits until system call is finished"
That's only true if the system service does synchronous I/O. Some operating system have asynchronous I/O calls that do not cause a wait.
"When a user process invokes a system call, the user process itself executes the kernel function in the kernel mode"
That is true when the system implements all its system services in kernel mode. Some system have multiple modes (often 4) that allow implementing system services that cannot possibly crash the system.
In any event, this might not be a synchronous I/O system service call. In that case, it might not wait. If you call a time system service, it is unlikely that your process will wait.
Upvotes: 1