Week 4 Flashcards
What is the process?
The process is the most fundamental abstraction of the operating system. It represents a single task the computer is doing.
Are processes tied to a specific hardware component.
No, unlike other absractions, processes are not tied to a specific hardware component.
What hardware does the concept of a process help virtualize?
The CPU
What are the elements of a process?
one or more threads
an address space containing instructions and runtime data structures
zero or more open file handles.
What are the 3 execution states of a process?
running: one of the processs threds is currently executing on the CPU
ready: the process is ready to run, but hsa yet to be scheduled by the CPU
blocked: the process is waiting for something before it can continue.
What is scheduling?
It is when we move between running/ready which is done by the OS/
What is the underlying mechnaism of saving and restoring the state of a process?
Context switching.
How does UNIX organize processes?
They organize them in trees.
Each process has a parent and can have 0 or more children.
When the parent terminates, all children terminate.
If a child terminates, the parent continues running.
In UNIX like OS’s who starts the first process?
Ad-hoc program executed by the kernel (init in Linux)
What are system calls (syscalls).
We have seen a process can call OS services using a trap.
These OS services are called syscalls.
In practice these calls are never called manually.
The C library has wrappers that take care of issuing syscalls.
What is exec()?
Is a system call that starts a new process by transforming the current process.
exec() duplicates the address space, then overwrites the text segment and reinitializes the stack and the heap.
Does not return if successful, returns -1 on failure. Use errno to figure out what went wrong.
What is fork()?
fork() is a system call that creates an almost exact copy of the running process. The original process is called the parent and the new process the child.
The child process starts running at the return from fork() and has its own copy of the address space, registers, any open file handles.
How does the forked process know it is the child?
Fork returns a PID to the parent, but a 0 to the child.
What is virtual address space?
The virtual address space is abstraction of the physical memory that makes memory simple for the process.
Each byte in memory is associated with an ________, allowing the process to access the memory location.
Each byte in memory is associated with an address, allowing the process to access the memory location.