-
Notifications
You must be signed in to change notification settings - Fork 17
Scheduling policies
C4Phone edited this page Dec 12, 2015
·
8 revisions
- Big picture:
- Creating new PIDs will always block the original thread
- Use fork() to create new thread 1. Thus spawning new process <=> fork() then exec()/makeKThread()
- different from Linux because of course requirements.
- exec() actually creates a new Process
- and it's the only function to create a new user process
- fork() creates a new Thread
- this is the only way to create a new task without blocking the original one
- Thus, this is very useful for instantiating multiple terminals
- makeKThread() creates a new Kernel "Process" (A new process with a single kernel thread). makeKThread accepts argument to customize everything about this "Kernel Process"
- Although "Kernel Process" does not have its own memmap,
- Kernel Process's execChild process inherit its Terminal/GUI client handle.
- Thus we utilize makeKThread when creating new Terminals/GUIs
Just use makeKThread() in the interrupt handler.
We disallow "blocking inside syscall":
We have to split all code related to "blocking" into two pieces:
"before-blocking" + "after-blocking", executed in two different interrupt handlers.
- we can pass important variables as C++ lambda capture
- terminal is owned by single thread, not a whole process
- signal is sent between whole processes.
- For each process there is one thread only used to execute signal handlers.