Quiz 3 (Processes) Flashcards

1
Q

The following command is the correct one to compile “example.c”:

gcc -o example.c example

True
False
A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

Segmentation fault (the program crashes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The act of switching processes between “running” and “ready” states is called “context switching”

True
False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The system call named ______ blocks the parent process until one of its children has finished executing.

A

fork

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

System calls are library calls

True
False
A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some machine instructions that can be used to trigger a system call on x86?

int 0x80

call 0x80

syscall

trap

A

syscall

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

Returns different values to the parent and child process

Duplicates the current process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The SYSCALL instruction is used on modern x86 platforms to trigger a system call

True
False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A process must specify which system call they intend to call by passing a system call number as parameter

True
False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

A

Processes run as much as possible directly on the hardware

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The program counter contains the parameters passed to a system call

True
False
A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

Pushing parameters on the stack

Writing parameters in CPU registers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A calling convention defines how parameters are passed to a function or a system call

True
False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The state of a process represents the information necessary for it to execute correctly

True
False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

  1. Program
  2. Process
A

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

  1. Program
  2. Process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly