2 Flashcards
(66 cards)
Q: What is a process in the context of operating systems?
A: A process is a program in execution. OS processes run in kernel mode, while user processes run in user mode.
Q: What are the memory segments allocated to a process?
A: Text (program code), stack, heap, and data.
Q: What is the stack segment used for in a process?
A: The stack stores temporary data, such as local variables, function parameters, and return addresses. Its size is known at compile time.
Q: What is the heap segment used for in a process?
A: The heap is used for dynamically allocated memory during runtime, for data whose size may be unknown beforehand.
Q: What is stored in the data segment of a process?
A: Global variables of fixed size.
Q: What is a Process Control Block (PCB)?
A: A PCB is a data structure in the kernel containing information about a process, such as process state, process ID, program counter, CPU registers, memory management info, I/O status, scheduling info, and accounting details.
Q: How is a process identified in the operating system?
A: By a process ID (pid) and a pointer to its PCB in kernel space.
Q: What are the possible states of a process?
A:
New: The process is being created.
Ready: The process is waiting for CPU assignment.
Running: Instructions are being executed.
Waiting: The process is waiting for an event.
Terminated: The process has finished execution.
Q: What is process scheduling?
A: It involves managing the ready queue and device (I/O) queues, which are generally stored as linked lists.
Q: What is a context switch?
A: A context switch saves the state of a process when its execution is suspended and reloads the state when the process resumes.
Q: How are new processes created?
A: A parent process creates child processes, forming a tree of processes. Each new process is given a unique process ID (pid).
Q: What are the resource-sharing options between parent and child processes?
A:
Parent and children share all resources.
Children share a subset of the parent’s resources.
Parent and child share no resources.
Q: What are the execution options for parent and child processes?
A:
Parent and children execute concurrently.
Parent waits until children terminate.
Q: What are the address space options for a child process?
A:
The child is a duplicate of the parent.
The child has a new program loaded into its address space.
Q: What is the starting point for process creation?
A: An already running process, typically initiated through a login procedure.
Q: What happens when a process needs to wait for an event?
A: It transitions to the waiting state until the event occurs.
Q: What is stored in the program counter of a PCB?
A: The address of the next instruction to be executed.
Q: Why are queues used in process scheduling?
A: To manage processes waiting for CPU or I/O resources efficiently, often implemented as linked lists.
Q: What happens when a process consumes its allotted CPU time?
A: It is preempted, and its context is saved for later resumption.
Q: What is the Portable Operating System Interface (POSIX)?
A: POSIX is an IEEE standard API that defines system calls and interfaces to improve the portability of applications across operating systems.
Q: Is POSIX an operating system?
A: No, POSIX is not an OS. It is a standard that operating systems can implement to reduce portability effort for applications.
Q: What does a system supporting POSIX provide?
A: A host language and compiler, programming interface definition files, programming interface implementation (binary or code), and a run-time system.
Q: What are the key system calls in the POSIX 1003.1 API for processes?
A: fork(), exec(), exit(), and wait().
Q: What does the exec() system call do?
A: It replaces the process memory space with a new program, effectively running a different program in the same process.