0% found this document useful (0 votes)
48 views6 pages

331 Study 1

An operating system acts as an intermediary between software and hardware, enabling program execution and accessibility for users. It has two main roles - software management including processes, memory, files and resources, and hardware management through interaction. Some common operating system types are batch, network, distributed, time-sharing and real-time. The operating system manages processes through state transitions between ready, running and blocked as it allocates CPU time, handles interrupts, and switches between programs using techniques like scheduling, dispatching and process control blocks.

Uploaded by

kossydaniel2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views6 pages

331 Study 1

An operating system acts as an intermediary between software and hardware, enabling program execution and accessibility for users. It has two main roles - software management including processes, memory, files and resources, and hardware management through interaction. Some common operating system types are batch, network, distributed, time-sharing and real-time. The operating system manages processes through state transitions between ready, running and blocked as it allocates CPU time, handles interrupts, and switches between programs using techniques like scheduling, dispatching and process control blocks.

Uploaded by

kossydaniel2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Questions and Answers COS 331 Operating System

1. What is an Operating System?


An operating system is a computer software that acts as an intermediary between software and
hardware in a system, enabling execution of programs and easier accessibility to users.
2. Describe the two general roles of an operating system, and elaborate why these two ae
important.
a. Software management: I would say this because this is one of the major roles of an operating
system, to manage software this includes processes, memory, file and resource management.
b. Hardware management: this is mostly concerning interaction with the hardware, if there is no
interaction with hardware, we would not be able to see what the system does
3. List Some types of Operating Systems.
a. Batch OS
b. Network OS
c. Distributed OS
d. Time-Sharing OS
e. Real-Time OS
4. What are the two main functions of an operating system?
This is according to the system design; you can write what you think is best here.
5. What is an interrupt?
An interrupt Is a signal sent by a hardware device or a software program to alert the CPU, telling
it that an event requiring immediate attention is needed. It is basically a signal sent by hardware
and software programs that is of high priority.
6. What is multiprogramming OS? What is the principal advantage and Disadvantage of
multiprogramming?
a. Multiprogramming OS: these are operating systems that allow one or more processes to run
simultaneously, and it keeps the programs in memory at the same time, one example of this
operating system is LINUX.
b. Advantages:
i. Fast
ii. Resource Sharing
iii. Improved multitasking
iv. Support for time-sharing
v. Increased CPU utilization
vi. Disadvantage:
i. due to its complexity, it can lead to conflict and system instability
ii. Deadlocks are common
iii. Increased overhead
iv. Difficulty in debugging
7. Define the following terms
a. API (application programming interface): this is a set of rules that allow different software
components to communicate and interact with each other.
b. Device drivers: these are software components that enable the operating system to
communicate with hardware devices, facilitating their operations
c. Memory map I/O: this is a technique that allows hardware devices to exchange data with the
CPU’s memory enabling communication between them.
d. Protocols: these are rules that govern communication between devices or systems ensure
that data is received and transmitted correctly.
e. System overhead: this is the amount of processing time used by system software while
managing processing and tasks.
f. Spooling: this is a technique used to queue and manage I/O tasks allowing multiple processes
to use devices efficiently.
g. Deadlock: this is a situation where processes are unable to proceed because each is waiting
for another to release a resource, resulting in a blocking or stand still.
8. Explain the difference between a program, process and Thread
Differences
a. Program: this is a set of instructions written in a programming language that can be executed
by the computer.
b. Process: this is a program in execution that has its own resources, memory space and state, it
is not the entire program itself, think if it as an instance of a program.
c. Thread: this can be called an instance of a process, it is also something the CPU does with
reference to a program, but can’t be called a process.
Relationship
the major relationship between them is that they are all subject to execution
9. With the aid of sketches, describe the process state transition diagram. What is a state in
state diagram? (check google for the diagrams they are plenty)
a state in a state diagram is the current condition of an object or process at a given time.
10. describe the three state process models states, and describe an event that might cause such a
transition.
a. Ready State: In this state, a process is ready to be executed but is waiting for the CPU to be
allocated to it. ("When a process is in the Ready state, it's waiting for the CPU to start running.
This happens when the CPU scheduler picks it to execute.").
An event that might cause a transition from Ready to Running state is when the CPU scheduler
selects this process to be executed.
b. Running State: In this state, the process is being executed by the CPU.
An event that might cause a transition from Running to Blocked (or waiting) state is when the
process issues an I/O request, like reading from a file or waiting for user input.
c. Blocked (or Waiting) State: In this state, a process is waiting for an event (like an I/O operation)
to occur before it can proceed. An event that might cause a transition from Blocked to Ready
state is when the requested I/O operation is completed, and the process can continue its
execution.
Valid Transitions Between them
1. Ready ->> Running: This transition occurs when the scheduler selects a process from the ready
queue and allocates the CPU to it.
2. Running ->> Blocked (or waiting): This transition happens when the process issues an I/O request
or some other event that requires it to wait for a resource. The process moves from the running
state to the blocked state.
3. Blocked (or waiting) ->> Ready: When the requested event (like an I/O operation) is completed,
the process moves from the blocked state back to the ready state.
11. Explain the process control block as a data structure
The Process Control Block (PCB) is a data structure in an operating system that holds crucial
information about a process, like its ID, current state, program counter, and resource usage. It
allows the OS to efficiently manage and switch between processes.
(for better understanding The Process Control Block (PCB) is like an ID card for a computer
program. It carries important details like its name, current job, and what it needs to do next. This
card helps the computer manage and switch between different programs smoothly.)
12. With the aid of sketches, explain the process Scheduling and Dispatching
>>Process scheduling is the method by which the operating system selects processes from the
ready queue to run on the CPU.

>>Dispatching is the act of sending a selected process to the CPU for execution.

13. Explain how OS manages the following process Calls, runtime, Create, Delete, Fork/Join, Abort,
Suspend, Resume, Delay, Get-Attributes and Change priority.

a. Process Calls: Programs request services from the OS using system calls.
b. Runtime: The OS monitors CPU time usage and allocates time slices to processes.
c. Create: The OS assigns resources and a unique ID when a process is initiated.
d. Delete: The OS reclaims resources when a process completes.
e. Fork/Join: fork () duplicates a process; join () waits for a child process to finish.
f. Abort: The OS ends a process due to errors or violations.
g. Suspend/Resume: Process execution can be temporarily halted and then resumed.
h. Delay: The OS can pause a process for a specific duration.
i. Get-Attributes: Processes can request information about themselves from the OS.
j. Change Priority: Processes can dynamically adjust their priority levels.

14. Explain the difference and the relationship between a program and a process Self-explanatory
A program is a set of instructions stored on a device, while a process is an active instance of a
program in a computer's memory. The relationship is that a program becomes a process when it
is loaded into memory and actively running.
15. How does the dispatcher decide which process to run next? How does OS regain control of the
processor?
The dispatcher chooses which process runs next. When a process finishes or pauses, the OS
takes back control. This happens through an interrupt, signaling an event that needs attention.
Then, the OS decides which process to run next. This switch is called context switching.

16. Crack your brain

17. On a system with n CPUs, what is the minimum number of processes that can be in the ready,
run and dormant states?
a. Ready State: Can have a minimum of 0 processes waiting to be executed.
b. Run State: Must have at least 1 process actively running on a CPU.
c. Dormant State: Can have a minimum of 0 processes waiting for events like I/O
operations.
18. For each of the following transitions between process states, indicate whether the transition is
possible. If it is possible, give an example of one thing that would cause it.
a. Run → ready
b. Run → dormant
c. Run → suspended
d. Ready → run
e. Run → terminated

a. Run → Ready: Possible. Example: Process issues an I/O request.

b. Run → Dormant: Typically, not possible. Process usually goes to Ready before Dormant.

c. Run → Suspended: Possible. Example: Process is intentionally paused.

d. Ready → Run: Possible. Example: Process is selected by the scheduler to run.

e. Run → Terminated: Possible. Example: Process completes its task or encounters an error
leading to termination.

19. Explain the concept of Interrupt management.


Interrupt Management is like a system's way of handling urgent requests. These requests, called
interrupts, can be from hardware (like a mouse click) or software (like a special request from a
program). When an interrupt happens, the computer pauses what it's doing and focuses on the
urgent task. Once done, it goes back to what it was doing before. This is essential for dealing
with quick, important events in a computer system.
Interrupt Management is like a computer's way of saying, "Hold on, something urgent just came
up!"
Example: Imagine you're playing a game on your computer and suddenly you press a key. That
key press is like an interrupt. The game pauses for a moment to process that key press before
continuing. This way, your computer can handle important things right away, even in the middle
of other tasks.
20. Name some advantages and disadvantages of user-level threads
Advantages
1. Lightweight and fast thread management.
2. Provides flexibility in scheduling and synchronization.
3. Portable across different operating systems.

Disadvantages:
1. Blocking system calls can affect entire process.
2. Limited parallelism due to potential blocking.
3. Lacks kernel-level optimizations and true multitasking.

21. Enumerate the advantages and disadvantages of supporting multi-threaded applications with
kernel-level threads.
Advantages:
a. True Parallelism: Kernel-level threads can execute in parallel on multiple CPU cores.
b. Improved Performance: They can utilize multiple processors or cores for higher system
performance.
c. Kernel Support: Robust support for thread management and synchronization is provided by the
kernel.
d. No Blocking Issues: Blocking system calls by one thread don't affect others in the same process.
e. Suitable for CPU-bound Tasks: Kernel-level threads are well-suited for tasks that are primarily
CPU-intensive.
Disadvantages:
a. Heavyweight: They consume more system resources, making them relatively heavier compared
to user-level threads.
b. Slower Creation and Synchronization: Interacting with the kernel for thread management can be
slower.
c. Limited Scalability: Creating a large number of kernel-level threads can overwhelm system
resources.
d. Less Flexible Scheduling: Kernel-level thread scheduling may have less flexibility in priority and
algorithms.
e. Potential for Blocking: While one thread's blocking call won't affect others, the entire process
might still get blocked.

22. Describe a sequence of step that occur when a timer interrupt occurs that eventually results in a
context switch to another application.
When a timer interrupt occurs, it triggers an interrupt service routine (ISR) that saves the current
state of the running process. The scheduler then selects the next process to execute and loads
its saved state. This process, known as a context switch, allows different applications to run
concurrently and ensures efficient resource allocation.

You might also like