Processes Items Flashcards

1
Q

What is process?

A

A process is a program in execution. It comprises the program code, associated data, stack, heap, and a Process Control Block (PCB) that stores its execution context.

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

What is the difference between process and program?

A

A program is a passive entity, such as a binary executable file residing on disk, whereas a process is an active entity, an instance of a program in execution, with its own memory space, resources, and execution state.

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

List five process states (use the naming from our textbook and class please)

A

New
Ready
Running
Blocked
Terminated

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

What is ready queue? How many ready queues do you expect in the system?

A

The ready queue is a queue containing all the processes that are ready to execute but are waiting for the CPU. The number of ready queues in a system typically corresponds to the number of processor cores in a system.

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

What is I/O queue? How many I/O queues do you expect in the system?

A

The I/O queue is a queue containing processes that are waiting for I/O operations to complete. The number of I/O queues in a system varies depending on the number and type of I/O devices present in the system.

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

What happens to a process when it requests I/O operation (like file reading) in the classic “blocking” scenario?

A

In the classic blocking scenario, when a process requests an I/O operation, it enters the Blocked state, relinquishing the CPU until the I/O operation completes.

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

Where does the process go once the I/O request is complete?

A

Once the I/O request is complete, the process transitions back to the Ready state, awaiting its turn to be scheduled for execution on the CPU.

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

Understand what happens to processes in reality when process states change (don’t be fooled by process “movements” in typical visualizations).

A

In reality, when process states change, the operating system updates the process control block (PCB) of the process to reflect its new state. The process may be moved between different queues or data structures depending on its state, and the CPU scheduler decides which process to execute next based on its scheduling algorithm.

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

Process Control Block (PCB). What typical components can you see there?

A

Typical components of a Process Control Block include Process ID, Program Counter, CPU Registers, CPU Scheduling Information, Memory Management Information, I/O Status Information, and Accounting Information.

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

Context switch. Why does context switching have a small performance overhead associated with it? How does that performance overhead affect system calls?

A

Context switching involves saving the state of the current process and loading the state of a new process, which requires switching CPU registers, memory maps, and other resources. This overhead is small but noticeable, as it involves flushing and reloading CPU caches and TLB entries. System calls incur this overhead when transitioning between user mode and kernel mode.

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

What is POSIX?

A

POSIX (Portable Operating System Interface) is a set of standards that define the interface between a Unix-like operating system and its applications, ensuring compatibility between different Unix-like operating systems.

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

fork()

A

The fork() system call creates a new process (child process) by duplicating the calling process (parent process). After a successful fork(), two processes are executing the same program, but with separate memory spaces.

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

exec()

A

The exec() system call is used to replace the current process image with a new one. It loads a new program into the current process space, overwriting the existing program and its data.

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

exit()

A

The exit() system call terminates the calling process and releases all its resources, including memory and open file descriptors.

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

wait()

A

The wait() system call suspends the execution of the calling process until one of its child processes terminates, allowing the parent process to obtain the exit status of the terminated child process.

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

Layout of a process in memory: text section, data section, heap, and stack.

A

Text Section: Contains the program’s executable code.
Data Section: Contains global and static variables initialized by the program.
Heap: Dynamically allocated memory for variables and data structures.
Stack: Contains local variables, function call frames, and control information.

17
Q

What are the properties of heap (it is fragmented, full of holes)? How does it affect the typical dynamic memory allocation like using the operator new?

A

The heap is dynamic and can become fragmented over time due to allocation and deallocation of memory. This fragmentation results in the heap being full of small holes, making it challenging to allocate contiguous blocks of memory. This fragmentation can lead to inefficient memory usage and slower allocation times when using dynamic memory allocation methods like the operator new.

18
Q

What are the properties of the stack?

A

The stack is a contiguous block of memory used for function call frames, local variables, and control information. It typically grows and shrinks dynamically as functions are called and return. Access to stack memory is fast and efficient, as it operates as a Last-In-First-Out (LIFO) data structure. However, the stack size is limited, and excessive recursion or large local variables can lead to stack overflow errors.