-
Notifications
You must be signed in to change notification settings - Fork 17
Scheduling policies
C4Phone edited this page Dec 3, 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).
- should be renamed to execKernel() (it also blocks the parent thread)
- which can call exec() to create a whole new user process.
- makeKThread accepts argument to customize everything about this "Kernel Process" 1. Although "Kernel Process" does not have its own memmap, 2. Kernel Process's execChild process inherit its Terminal/GUI client handle. 3. Thus we utilize makeKThread when creating new Terminals/GUIs
- We use makeKThread to instantiate the 4 different shells on the 4 Text-mode Terminals.
- Because: if we use fork() to accomplish this, fork() must be able to move some program from terminal 0 to terminal 3, which is unsafe and breaks abstraction.