Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
18 Cards in this Set
- Front
- Back
Process |
Program in execution Program = recipe (instructions) for making a cake Process = activity of making the cake |
|
Creating a process in UNIX |
2 system calls: fork() exec() |
|
fork() |
creates a duplicate of the calling process and both processes execute the next instruction |
|
exec() |
uses executable as parameter calling process is overwritten by the process created to run this executable |
|
What happens when you type "a.out" in the shell? |
Shell does a fork() The duplicate created by fork() does an exec() with the file a.out as a parameter |
|
Batching |
Performing the activities one after another |
|
multi-programming/time-sharing |
Time-multiplex the CPU among the processes |
|
How do we implement time-sharing? |
Preempting the CPU from the currently executing process Give the CPU to another process that can potentially use the CPU |
|
Context-switching |
Re-assigning of the CPU from one process to another. Is transparent to an application, do not want applications to be aware |
|
When should OS perform context switching? |
When an application process cannot proceed Periodically |
|
Implementing context-switch |
Save the "context" of the current process Restore the "context" of another process |
|
Context |
The state of the process that is necessary for its execution |
|
Address space |
Code Segment + Data Segment + Stack Segment + Heap Segment |
|
Process Control Block (PCB) |
Data structure into which context is saved and restored from |
|
Advantages of a "process" view |
Implement concurrency Insulate one activity from another |
|
Drawbacks of a "process" view |
Heavy weight - higher scheduling (context switch) costs - Direct costs of switching address spaces - Indirect costs (e.g. cache flushes) State sharing |
|
What are the overheads of process view? |
Switching code, data, stack and heap Saving and restoring registers Saving and restoring other state maintained by OS |
|
pthread_create() pthread_exit() pthread_join() pthread_self() |
create a thread terminate a thread wait for a thread to exit returns thread id |