Week 4 Flashcards

1
Q

What is the process?

A

The process is the most fundamental abstraction of the operating system. It represents a single task the computer is doing.

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

Are processes tied to a specific hardware component.

A

No, unlike other absractions, processes are not tied to a specific hardware component.

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

What hardware does the concept of a process help virtualize?

A

The CPU

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

What are the elements of a process?

A

one or more threads

an address space containing instructions and runtime data structures

zero or more open file handles.

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

What are the 3 execution states of a process?

A

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.

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

What is scheduling?

A

It is when we move between running/ready which is done by the OS/

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

What is the underlying mechnaism of saving and restoring the state of a process?

A

Context switching.

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

How does UNIX organize processes?

A

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.

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

In UNIX like OS’s who starts the first process?

A

Ad-hoc program executed by the kernel (init in Linux)

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

What are system calls (syscalls).

A

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.

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

What is exec()?

A

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.

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

What is fork()?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does the forked process know it is the child?

A

Fork returns a PID to the parent, but a 0 to the child.

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

What is virtual address space?

A

The virtual address space is abstraction of the physical memory that makes memory simple for the process.

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

Each byte in memory is associated with an ________, allowing the process to access the memory location.

A

Each byte in memory is associated with an address, allowing the process to access the memory location.

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

How is the address space divided? What are the 3 separate segments.

A

stack: used to support function calls and local variables, grows and shrinks during execution.

heap: used for dynamically allocated, user-managed memory.

text: the instructions of the program.

16
Q

What is wait()?

A

wait() is a system call that blocks the parent process until one of its children has finished executing.

Performing a wait allows the OS to release the resources associated with the child, thereby avoiding zombies (technical term).

17
Q

glibc has a ________ function truncate for the truncate system call.

A

glibc has a wrapper function truncate for the truncate system call.

18
Q

________ is a wrapper around the execl and fork system calls.

A

system

19
Q

What is a program counter (PC)?

A

Is a hardware register that indicates the next instruction to execute. The PC is also called the instruction pointer.

20
Q

How are arguments passed to functions via registers?

A

In 64 bit x86 as defined by the calling convention.

21
Q

How does Linux do system calls.

A

Write the system call code to the %EAX register.

Trigger software interrupt 0x80.

22
Q

What is a kernel mode?

A

It is the highest privilege that can be run.

23
Q

What is a trap?

A

simultaneously raises the privilege level and jumps into the OS.

24
Q

What is a return from trap.

A

Drops privilege level and returns into user process.

25
Q
A