Quiz 3 (Processes) Flashcards
The following command is the correct one to compile “example.c”:
gcc -o example.c example
True False
False
What happens if I run “int* ptr = 0; *ptr = 42;” ?
The value pointed at by ptr is set to 42
Segmentation fault (the program crashes)
Nothing; the code does not compile
The value pointed at by ptr is set to 0
Segmentation fault (the program crashes)
The act of switching processes between “running” and “ready” states is called “context switching”
True False
True
The system call named ______ blocks the parent process until one of its children has finished executing.
fork
System calls are library calls
True False
False
What are some machine instructions that can be used to trigger a system call on x86?
int 0x80
call 0x80
syscall
trap
syscall
What does the “fork” system call do? Select all that applies.
Transforms the current process by overwriting the text segment (code) with a different program
If successful, does not return a value
Returns different values to the parent and child process
Duplicates the current process
Returns different values to the parent and child process
Duplicates the current process
The SYSCALL instruction is used on modern x86 platforms to trigger a system call
True False
True
A process must specify which system call they intend to call by passing a system call number as parameter
True False
True
What does limited direct execution mean?
Processes run as much as possible directly on the hardware
Processes are terminated every time there is a disk access
The OS intercept every instruction executed by a process
Processes cannot execute unless in privileged mode
Processes run as much as possible directly on the hardware
The program counter contains the parameters passed to a system call
True False
False
What are some possible ways a process can pass parameters to the OS when executing a system call?
Pushing parameters on the stack
Passing parameters through the network driver
Writing parameters to disk
Writing parameters in CPU registers
Pushing parameters on the stack
Writing parameters in CPU registers
A calling convention defines how parameters are passed to a function or a system call
True False
True
The state of a process represents the information necessary for it to execute correctly
True False
True
Match the term to the correct description
____
A program that has been loaded into memory for execution
____
A sequence of instructions stored in a file
- Program
- Process
Match the term to the correct description
__2__
A program that has been loaded into memory for execution
__1__
A sequence of instructions stored in a file
- Program
- Process