Processes Flashcards

1
Q

What is a process?

A

A process is a container that holds all the information needed to run a program. It includes the program’s instructions, variables, attributes, and the associated execution context.

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

What is the purpose of a process in an operating system?

A

The purpose of a process is to execute a program and manage its resources. It allows for concurrent execution of multiple processes, each with its own context, without interfering with each other.

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

What information does a process contain?

A

A process contains the program’s instructions, variables, temporary data, ownership information, file usage, and other attributes relevant to its execution.

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

Where is most of the process’s context stored?

A

Most of the process’s context, including its instructions and variables, is stored in memory. The process has its own address space within the memory, which may be contiguous or fragmented into logical segments.

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

What is a process control block (PCB)?

A

A process control block is a data structure maintained by the operating system to store private information about a process. It tracks the process’s resources, ownership, and other relevant details.

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

How does the operating system manage the execution of multiple processes?

A

The operating system’s scheduler manages the execution of multiple processes by determining when a process should run, get blocked, or be pushed aside to allow other processes to execute. This scheduling ensures fair and efficient utilization of system resources.

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

What is the relationship between processes in a Unix-like system?

A

In a Unix-like system, processes are organized in a hierarchy, where each process has a parent process. The first process (number 0) forks the init process, which becomes the parent of subsequent child processes.

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

What happens to orphaned child processes in Unix-like systems?

A

If a parent process expires before its children, the orphaned child processes are adopted by the init process. This ensures that the operating system maintains control over all active processes.

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

What are “zombie” processes in Unix-like systems?

A

“Zombie” processes are child processes that have terminated but have not been observed by their parent processes. The operating system retains the details of these terminated processes until the parent synchronizes with them. Persistent zombies usually indicate a bug in the system.

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

What does the context of an executing process include?

A

The context of an executing process includes its variables, resources, and environment in which it operates.

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

Where is most of the context of a process stored?

A

Most of the context of a process is stored in the main memory of the computer. This includes variables in memory or processor registers and resources owned by the process.

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

What is a Process Control Block (PCB)?

A

A Process Control Block (PCB) is a data structure associated with a process. It contains or points to information such as the process’s identity, parent, priority, and resources it is holding.

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

Why are register values part of the process’s context?

A

Register values hold temporary variables during execution and are part of the process’s context. They need to be saved by the operating system in reserved memory during a context switch.

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

How does a simple processor handle multiple processes?

A

A simple processor can only run one process at a time. If a computer is running several processes simultaneously, it actually performs context switching, running one process for a short time before switching to another.

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

What is the purpose of context switching?

A

Context switching allows a computer to allocate processor time to different processes. It involves saving the context of the currently running process and restoring the context of the next process to be executed.

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

What is the impact of a busy system on a favourite process?

A

In a busy system, a favourite process may perceptibly slow down as it gets a lesser share of processor time. Context switching between multiple processes takes place rapidly, but heavy load can affect individual process performance.

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

What components are included in a process’s full context?

A

A process’s full context includes the state held within the processor (registers, etc.), the memory management page tables, a list of owned resources, and any specific cached information such as the level-1 virtual cache and TLB contents.

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

What is the purpose of a control block in an operating system?

A

The control block, also known as a Process Control Block (PCB), is the operating system’s definition of a process. It holds information about a process, such as its identifier (PID) and priority.

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

What information is stored in a PCB?

A

A PCB holds or points to various parts of a process’s context that are preserved when the process is not actively running. This may include register values, memory allocation, opened files, and ownership of I/O devices.

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

What determines the specific details stored in a PCB?

A

The specific details stored in a PCB depend on the particular operating system. Different operating systems may store different information in the PCB based on their design and requirements.

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

How are PCBs typically organized in an operating system?

A

A typical implementation of a PCB includes one or more links that can point to other PCBs. This allows them to be assembled into linked lists, making it convenient to form queues, such as the ready queue of processes waiting to run on the processor.

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

What is the PCB an example of?

A

The PCB is an example of metadata in an operating system. It serves as descriptive information about a process, providing essential details for the operating system to manage and schedule processes effectively.

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

What is the purpose of a scheduler in an operating system?

A

The scheduler is responsible for deciding which process(es) to run at any given time in a multi-tasking operating system.

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

What is round-robin scheduling?

A

Round-robin scheduling is a common approach in interactive systems where all processes are given equal turns. The scheduler maintains a FIFO queue and selects the next process from the front while appending a descheduled process to the back.

25
Q

What is the purpose of real-time processing?

A

Real-time processing requires guaranteed response with a specific maximum latency. It prioritizes tasks based on urgency and time constraints, ensuring timely execution.

26
Q

What is the difference between hard and soft real-time tasks?

A

Hard real-time tasks have strict constraints, and failure to meet those constraints leads to system failure. Soft real-time tasks have more flexible constraints, and undue delay may cause annoyance.

27
Q

What is batch scheduling?

A

Batch scheduling completes one job before proceeding to the next, making it efficient for processing large amounts of data. It is not responsive to interactions but focuses on job completion.

28
Q

What is the “shortest job first” approach in batch processing?

A

The “shortest job first” approach in batch processing prioritizes jobs based on their duration. It aims to finish more jobs sooner by selecting the shortest job first, optimizing overall latency.

29
Q

Why do we need scheduling in computer systems?

A

Scheduling is necessary to manage multiple processes and determine how they are executed based on their usage and requirements.

30
Q

What is the purpose of scheduling in interactive systems?

A

In interactive systems, scheduling allows the illusion of running multiple processes simultaneously by time-sharing. It reduces latency and ensures that all processes get a turn to execute.

31
Q

What are the characteristics of scheduling in real-time systems?

A

In real-time systems, the focus is on guaranteed response time. Context switching may be minimized, and processes are often prioritized to meet time constraints and reduce response latency.

32
Q

What is the purpose of scheduling in batch systems?

A

Batch systems prioritize processing efficiency for big, processor-intensive jobs. Latency is not critical, and pre-emption is not a concern.

33
Q

What does a multi-tasking operating system provide in terms of process execution?

A

A multi-tasking operating system provides the illusion of executing multiple processes simultaneously by time-sharing and queuing processes for execution.

34
Q

What does it mean for a process to be blocked?

A

A process is blocked when it is unable to make progress, typically due to waiting for I/O devices, communications, or being deliberately put to sleep.

35
Q

What is time slicing in process scheduling?

A

Time slicing is a scheduling technique where a process is allowed to run for a certain time, and then it is swapped out to give another waiting process a chance to execute.

36
Q

What are the possible states of a process?

A

A process can be in one of the following states:

Ready: Waiting to be scheduled and run by the operating system.
Running: Currently executing its instructions.
Blocked: Unable to proceed until a certain event occurs or condition is met.
37
Q

What is the purpose of queuing in process scheduling?

A

Queuing is used to manage the ready processes, allowing them to wait for their turn to be scheduled and executed.

38
Q

How does the availability of multiple cores in a processor affect process execution?

A

With multiple cores, more processes can be running simultaneously, assuming they are available. Each core can execute a separate process, enabling greater parallelism and potentially improved performance.

39
Q

What is a thread of execution?

A

A thread of execution refers to a single, sequential series of machine instructions or lines of code.

40
Q

What are threads and how are they related to processes?

A

Threads, also known as lightweight processes, exist within processes. While processes are separate instances of programs, threads share resources and a virtual memory map within the same process.

41
Q

What are the differences between processes and threads?

A

Differences between processes and threads include:

Threads within the same process share access to resources and a virtual memory map.
Switching threads within the same process is faster and less resource-intensive compared to switching processes.
42
Q

How can threads be managed in an application?

A

Threads can be managed by either the operating system scheduler or a separate scheduler within the application itself. In Java, threads scheduled within the application are referred to as “green threads.”

43
Q

What are the advantages and disadvantages of managing threads at the user level?

A

Managing threads at the user level allows for faster thread switching and more tailored scheduling but requires additional management software and relies on cooperative scheduling. Blocking one thread can potentially block all threads in the same process.

44
Q

How does the operating system handle thread management?

A

The operating system can manage threads similarly to processes, allowing for context switching. While context switching within the same process can be cheaper than process switching, it may still incur overhead compared to application-level management.

45
Q

What does “multi-threading” refer to?

A

“Multi-threading” is a term used to describe the running of multiple threads or processes on a single machine, often referring to threads within the same program that closely cooperate.

46
Q

What are the benefits of multi-threaded code?

A

Multi-threaded code offers advantages such as simpler source code, easier problem decomposition into semi-independent units, and the ability to schedule functions in an efficient order. It allows for asynchronous code execution and keeps the processor(s) busy.

47
Q

How can multi-threading lead to higher performance?

A

As processors are not getting significantly faster but increasing in number, multi-threading enables a larger number of cores to be utilized effectively. Threading the code can result in higher performance by leveraging the available processors.

48
Q

What are some examples of processors with multiple cores and threads?

A

Examples include Graphics Processing Units (GPUs) with over 1000 processors and general-purpose processors like the SPARC M8 with 32 cores and up to 8 threads per core.

49
Q

What is the biggest drawback of multi-threading?

A

The main drawback is the increased complexity of programming in a multi-threaded environment. Unpredictable order of operations and dependencies between threads can lead to confusion, subtle faults, and difficulties in debugging. Deadlock, where threads stop each other from proceeding, is another concern.

50
Q

Why are issues related to multi-threading becoming increasingly important in applications programming?

A

These issues have been common in multiprocessing operating systems for a long time, but with the proliferation of processors and the need for higher performance, they are becoming more significant in applications programming.

51
Q

What is interprocess communication?

A

Interprocess communication is the process of exchanging data and coordinating between processes by utilizing some form of operating system intervention, as each process has its own context protected from other processes.

52
Q

What is shared memory in interprocess communication?

A

Shared memory is a method of communication where processes or threads share a portion of RAM to exchange data. A protocol is usually required to ensure proper data visibility and synchronization.

53
Q

How can interprocess communication be achieved using files?

A

Processes can communicate by altering file-system contents, making the changes visible to all processes with the permission to read them. While convenient for large data quantities, file-based communication has significant overhead for day-to-day operations.

54
Q

What are messages in the context of interprocess communication?

A

Messages are data blocks sent from one process to another, even across different machines. They are a means of communication where processes do not share memory or file storage. Message passing can be synchronous or asynchronous, affecting the timing and coordination of communication.

55
Q

How are signals used in interprocess communication?

A

Signals can be used for synchronization, asynchronous events, and communication between processes. Signals can request a process to stop or start, indicate anomalies, or interrupt a running process. Signals provide a way to communicate information between processes.

56
Q

What is a pipe in the context of interprocess communication?

A

A pipe is a FIFO (First-In-First-Out) concept used to connect processes. It allows one process to write data into the pipe, which can then be read by another process. Pipes can carry data streams or structured messages.

57
Q

What is a barrier in interprocess communication?

A

A barrier is a synchronization mechanism used to ensure that no process or thread gets too far ahead of others it is working with. It communicates information between processes to coordinate their progress. Barriers are useful in parallel applications to synchronize tasks or exchange results.

58
Q

What is a memory barrier in interprocess communication?

A

A memory barrier is a synchronization mechanism at the level of machine operations (loads and stores). It ensures that all operations in one set complete before any in the next set, providing consistency and synchronization between processes or threads.