Question 1
EasyWhat is the difference between a program and a process?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Operating Systems
What is the difference between a program and a process?
A program can have only one process
A program is passive code on disk; a process is a program being executed
They are the same thing
A process is stored on disk; a program runs in memory
Answer: B
A process is an active instance of a program, with its own memory, registers and state. One program can run as many processes.
Which of these is NOT stored in a process control block (PCB)?
The process state
The program's source code
The process ID
The CPU register values
Answer: B
The PCB holds bookkeeping such as PID, state, program counter, registers, scheduling and memory information — not source code.
Which of these is NOT a standard process state?
Waiting
Compiled
Running
Ready
Answer: B
Processes move between new, ready, running, waiting (blocked) and terminated. 'Compiled' describes a program, not a process state.
What do threads of the same process share?
The code, data and open files of the process
Their stacks
Their program counters
Their register values
Answer: A
Threads share the process's address space (code, globals, heap) and open files, but each has its own stack, registers and program counter.
What is saved during a context switch?
The state (registers, program counter) of the running process
The entire RAM
The contents of the hard disk
The source code of the program
Answer: A
The CPU state of the old process is saved in its PCB and the new process's state is loaded, so each can later resume where it left off.
What is an orphan process?
A process that has finished but not been waited for
A process whose parent has terminated
A process that cannot be scheduled
A process without any threads
Answer: B
When a parent exits first, its children become orphans and are adopted by init (or systemd), which later reaps them.
Which is generally cheaper to create: a thread or a process?
They cost the same
A process
A thread
It depends only on the programming language
Answer: C
A new thread shares its process's memory and resources, so creating it needs far less work than creating a new address space for a process.
What is a thread?
A cable between two computers
A program waiting to be installed
A file stored on disk
The smallest unit of execution that the CPU schedules, running inside a process
Answer: D
A process can contain several threads, each with its own flow of execution.
Which state does a newly created process enter after it has been admitted by the OS?
Ready
Running
Terminated
Waiting
Answer: A
A new process is admitted into the ready state, where it waits for the CPU.
What is the ready queue?
The list of finished processes
The list of processes in memory that are waiting for the CPU
The list of files waiting to be printed
The list of users waiting to log in
Answer: B
Processes in the ready queue have everything they need except the CPU.