QUESTIONS WITH ANSWERS
2025 NEW
Operating system definition - CORRECT ANSWER>>>>Software that converts
hardware into a useful form for applications. The OS makes sure the system operates
correctly and efficiently in an easy to use manner.
3 pieces of every modern OS - CORRECT ANSWER>>>>a. virtualization = makes each
application believe it has certain critical resources to itself
b. concurrency = events are running simultaneously and may interact with one another
c. persistence = access information permanently, the lifetime of information is longer
than lifetime of any one process
Reasons for studying operating systems - CORRECT ANSWER>>>>- build, modify,
and administer an OS
- understand system performance (behavior, tune workload performance, apply
knowledge across many layers)
- fun and challenging to understand, complex system
Definition of a process - CORRECT ANSWER>>>>an execution stream in the context
of a process execution
Definition of an execution stream - CORRECT ANSWER>>>>A stream of executing
instructions, a running piece of code, "thread of control"
What is a process execution state? - CORRECT ANSWER>>>>Everything that the
running code can affect or be affected by; register, address space, open files, etc.
Difference between a process and a program - CORRECT ANSWER>>>>A program is
a static collection of code statements and data that sits on a disk and must be moved to
memory in order to run.
A process is a dynamic instance of code and data that actually is able to execute
What are typical interfaces/actions provided by the process API? - CORRECT
ANSWER>>>>create, destroy, wait, misc control, status
What doe the OS (unix/linux) do to create a process? - CORRECT ANSWER>>>>The
OS brings (at least part of) the program's code and static data from the disk. It then
,allocates space for a stack segment and heap segment, sets up all I/O facilities, then
when it's time to run the process, the OS will start running it at it's entry point which is
stored as part of the executable which runs as a process.
3 processes state - CORRECT ANSWER>>>>1. ready: everything the process needs
to run is in memory but the process is not executing instructions on the CPU yet. It is
waiting in line to use the CPU.
2. running: the process is actually executing instructions on the CPU
3. blocked: the process is waiting in line for some event to occur like waiting for the disk
drive to do an I/O transfer.
How is the CPU shared by processes in the system? - CORRECT
ANSWER>>>>Processes share the CPU by using time-sharing. This means that each
process shares the CPU and other resources in time and space periodically so that it
gives the impression that each process is using it at once.
Difference between direct execution and limited direct execution? - CORRECT
ANSWER>>>>Direct execution allows the user to run their program directly on the
hardware such that the OS creates the process and transfers control to the starting
point. Limited direct execution allows the hardware and OS to maintain some control.
Problems with direct execution: - CORRECT ANSWER>>>>- process can do something
it isn't allowed to do
- process could run forever
- process could do something slow like I/O
How does the hardware and OS provide limited direct execution by processes on the
CPU? - CORRECT ANSWER>>>>a status bit, system calls, and interrupts and
exceptions
What is the status bit - CORRECT ANSWER>>>>Which mode the process is running
in. User processes run in user mode/restricted and OS runs in kernel mode/unrestricted
What is the difference between an interrupt and an exception? - CORRECT
ANSWER>>>>Interrupts are raised by a device such as the disk drive during I/O while
exceptions are interrupts from the software such as division by zero.
2 types of exceptions - CORRECT ANSWER>>>>1. traps = instruction does not
execute again after the trap is handled by the OS. Used for situations like divide by zero
2. faults = when an instructions causes a fault, it executes again after the fault is
handled by the OS
Why doe the CPU rather than the OS have to change the status bit from user to
privileged mode? - CORRECT ANSWER>>>>If the mode bit is set to user and the
kernel is able to change it, then the user process would be allowed to make this change
and the purpose of the mode bit is defeated.
, Does the CPU or the OS change the status bit from privileged mode to user mode?
When does this happen? - CORRECT ANSWER>>>>When the kernel is ready to
transition back to user mode, the OS changes the status bit and puts the address of the
next instruction of the user process to run on the PC.
What kinds of things are user processes not allowed to do in user mode (obvi)? -
CORRECT ANSWER>>>>General memory access, disk I/O, special y86 instructions
like changing the PC address
What happens if a user process tries to do something which is restricted? - CORRECT
ANSWER>>>>The CPU is taken away from it and the OS kills the process. This is
called a segmentation fault.
How is the CPU taken away from a user process which is executing instructions? -
CORRECT ANSWER>>>>option 1: cooperative multitasking = trusting the process will
relinquishes CPU to OS through traps
option 2: true multitasking = guarantees that the OS will obtain control periodically
(WHAT IS ACTUALLY USED)
What is a context switch? - CORRECT ANSWER>>>>Saves the context or process
execution state of a process that was interrupted in a PCB.
What data is saved for one process and restored for another when a context switch
occurs? - CORRECT ANSWER>>>>PID, process state, execution state (registers, PC,
stack pointer), scheduling priority, accounting information, credentials, pointers to other
allocated resources like open files
Problems with cooperative multitasking - CORRECT ANSWER>>>>- requires special
hardware support
- when running process performs an operation that doesn't use CPU, OS switches to
process that needs it
- OS must track mode of every process
- OS must track every process in the system
What does uninx/linux fork do? What are the things that must be done to create a new
process? - CORRECT ANSWER>>>>Fork calls to the OS which causes a new process
(child of its parent) to be created. It returns the PID of this child to the parent and 0 to
the child if successful. When the OS creates the child, it is assigned its own PID, gets a
separate address space which contains a copy of its parents to begin. The OS also
creates a PCB for the child and it gets a copy of the parents register values.
What is the relationship between the parent's address space and the child's address
space? - CORRECT ANSWER>>>>The child gets a copy of the parents address space