Week 3/4 Flashcards
(20 cards)
Virtualizing the CPU
creates an illusion that many virtual CPUs exist when there is only one physical CPU
Time Sharing
A technique that allows users to run concurrent processes. Allows the resource to be used by ONE entity for a short time and then another entity and so on.
Space Sharing
Resources are divided in space among the processes who want to use it.
Mechanisms
Low-level machinery / Low-level methods or protocols that implement a functionality
Context Switching
The underlying mechanism of saving (and restoring) the state of a process..
gives OS the ability to stop running a program and start running another on a CPU.
Policies
algorithms for making a decision within the OS.
Machine State
what a program can read or update when its running. Some components include:
Memory
I/O information
Program Counter (PC)
tells us which instruction of the program will execute next
How does process creation work?
1.Load code to any static data
2.OS allocates memory for the stack and heap
3.OS does initialization tasks like I/O streams
4.Run the program through main()
—————————-
Another Answer (for LINUX):
- using fork() to create a parent/child process
- using exec() on the child process to transform the process intoanything the user wants
- First process (init) started by the kernel
Done w/ the help of a process tree
Loading data history (Early vs Now)
Early times: loading processes were done eagerly (all at once)
Now: loading processes are done lazily (loads data only as needed)
3 Process States
Running: currently executing instructions
Ready: process is ready to run
Blocked: not ready to run because another event is taking place (such as an I/O operation). This allows the OS to run a different process.
Scheduled
When a process is moved from ready to running
Descheduled
When a process is moved from running to ready
Other Process States
Initial and Final (Zombie) States
Process List
contains information about all the processes in the system, each entry is found in a process control block (PCB). Allows the OS to track pieces of info
The process Tree Model
Organizing processes in trees where:
- each process has a parent, that can have 0 or more children.
- When the parent terminates, all children terminate
- If the child terminates the parent continues running
Who starts the first process?
init in Linux
What are system calls/syscalls
basically a function created by the OS.
wrappers take care of issuing syscalls
Meaning the calls themselves dont execute the function but the syscalls inside the actual function after it is called.
How to create a start of a simpel shell that reads commands
while (TRUE){
type_prompt();
read_command(command,parameters);
}