R. Clayton (rclayton@monmouth.edu)
Mon, 23 Oct 2000 11:51:09 -0400 (EDT)
If a system call interrupt occurs, say for an open, isn't that considered after
the system call? I don't understand the timing - when it's before system call
or after system call.
The timing is relative to a programmer making the system calls. The easiest
way to think about is it in terms of system calls from c
// this is before the system call.
syscall(system_call::open, device::disk);
// this is after the system call.
If that's too high level, you can think about it in assembly:
move 0, system_call::open
move 1, device::disk
// this is before the system call
sysc
// this is after the system call
move dev_stat, @0
move dev_id, @1
The timing is the same for the programmer implementing the system calls,
although in this case it makes sense to also talk about during the system
call.
Also, if the system call is an open for a disk device, what is it that we are
opening?
That's for you to decide as the os designer.
You can't read or write until you've opened.
And also after you've closed. That's correct, for both disk and terminal.
Disk read - multiple processes can read from the same disk id.
No, each valid device id for any device should belong to exactly one process.
3. Disk write - only 1 process can write to a disk at a time. (Does this mean
that once a process completes a write call, then other processes can read
again? Or does the process that wants to write to disk need to open, write,
close before any other process can read?)
Only one process can read or write to a disk at a time. Once a process
successfully opens a disk, it may issue any sequence of read or write
commands it wants. It's the job of your os software to keep track of, and
eventually execute, all the processes' disk-io operations.
4. Terminal read/write - only 1 process can read and write to the same terminal
id?
Yes, just like the disk. However, at most one process can hold a valid
terminal id, unlike the disk, where any number of processes can hold a valid
disk id (with each process holding a valid disk id different from all the
other valid disk ids).
This archive was generated by hypermail 2.0b3 on Mon Dec 18 2000 - 13:30:05 EST