Scheduling, keyboards and IPC
Posted: Fri Feb 21, 2014 7:57 am
I'm not sure if this should belong in this sub forum or the other one... Either way.
Finally after what seems like an eternity, I've got a system that's runs stable for more than 48 hours. Right now I'm implementing a simple userspace shell program, and I have a couple of issues:
1. How is keyboard input generally handled? In UNIX the process opens a file handle to stdin and uses general Read() and Write() functions, but is there another way?
2. Currently I have the driver set up with IPC, where it sends messages to the process and the process will get key presses from that. This is more of a microkernel approach (isn't it?) but that wasn't what I was aiming for... Is this a good thing, or too much of a performance impediment?
3. Say I go with the method described in (2). (this question probably applies to other things as well). How would scheduling work? Right now I'm theorising that the large (noticeable) lag when typing is caused by a amalgamation of factors, including system calls (interrupt gates) to read the message, the fact that the shell process is not immediately scheduled when a message is received, etc.
The third question bugs me the most. Say, for example, that Process A receives a message and it just got preempted and is at the back of the queue (assuming a single-priority, equal timeslice scheduler). Should receiving a message interrupt the current process and run Process A; insert Process A right after the current running process, or something else?
I think this applies for waiting for I/O accesses as well, like reading a file synchronously. File I/O isn't as urgent as something like keyboard input though.
Suggestions?
Finally after what seems like an eternity, I've got a system that's runs stable for more than 48 hours. Right now I'm implementing a simple userspace shell program, and I have a couple of issues:
1. How is keyboard input generally handled? In UNIX the process opens a file handle to stdin and uses general Read() and Write() functions, but is there another way?
2. Currently I have the driver set up with IPC, where it sends messages to the process and the process will get key presses from that. This is more of a microkernel approach (isn't it?) but that wasn't what I was aiming for... Is this a good thing, or too much of a performance impediment?
3. Say I go with the method described in (2). (this question probably applies to other things as well). How would scheduling work? Right now I'm theorising that the large (noticeable) lag when typing is caused by a amalgamation of factors, including system calls (interrupt gates) to read the message, the fact that the shell process is not immediately scheduled when a message is received, etc.
The third question bugs me the most. Say, for example, that Process A receives a message and it just got preempted and is at the back of the queue (assuming a single-priority, equal timeslice scheduler). Should receiving a message interrupt the current process and run Process A; insert Process A right after the current running process, or something else?
I think this applies for waiting for I/O accesses as well, like reading a file synchronously. File I/O isn't as urgent as something like keyboard input though.
Suggestions?