- Does the process have the privileges to make this particular system call? (the priv structure for this process in the process table is looked up to determine this)
- In the case of a 'send' or 'notify', is the destination a valid process? In the case of a 'receive' is the source a valid process? Note that a caller can specify 'ANY' as its source in which case it is looking for a message or notification from any process, so this check is unnecessary for that case. 'ECHO' is also a special case where this check doesn't make sense.
- Does the message pointer point to a valid region in memory i.e. is it really within the memory map limits of the calling process? Again, the memory map limits are available in the memmap struct for this process in the process table.
- If the request is to 'send' to some process, is the caller allowed to send to the destination process?
- Is the destination process running?
- Has system shutdown started?
Refer to the 'Message Primitives and Process States' diagrams (preceding posts) for details on what happens within the above functions.
Comments welcome.
I have been reading about MINIX drivers and I have this doubt: The authors call the drivers in execution as "tasks" and place them in 2nd layer. What kind of system calls do these tasks execute? At first, I thought they do not execute any system calls but get things done by calling procedures directly since they are linked to the kernel. But then again, they can block waiting for interrupts from device controllers. So I think they do use system calls (to do some receiving, perhaps..? I am not sure of anything.) And, what happens when a task is in blocked state (waiting for an interrupt from its respective controller) and file system process tries to request some thing from that task? Since the task is waiting on an interrupt and is not open to receiving messages from file system, will file system process be blocked? That means any process that wants to request some thing of the file system process is blocked?
ReplyDeleteI'll get back to you. Please give me some time.
DeleteHaritha,
ReplyDeleteSorry about the delay. The processes in Layer 2 are the drivers and as far as I know, they are not called anything else. The only 'tasks' are the 'System' task and the 'Clock' task.
Your question is about the drivers. The drivers execute system calls just like any other process in layers 3 and 4. The system calls end up in calls to the messaging primitives which causes process state transitions and context switches.
No, drivers cannot call kernel code directly. They have to rely on system calls and the messaging primitives (send, recv etc.). Only the System and Clock tasks can call kernel code directly. Remember that Layers 2, 3 and 4 are the user mode layers. Only Layer 1 is in kernel mode.
You are right that the drivers can block waiting for inputs from devices. They will usually transition to the 'ready' state after an interrupt routine has run for the corresponding hardware interrupt.
The answer to the last couple of questions in your message is yes. The file system process can be blocked and processes that want to talk to the file system can get blocked as a result. This is not so inconceivable. Multiple processes can block for IO since the IO device (hard disk or other) can be read only serially.
Thanks very much for replying. That clarifies my doubts.
ReplyDelete