Computer Science Report
Computer Science Report
The operating system not only acts as an interface (read middle man)
between the computer's user, the application software, and the hardware,
but must also manage the many resources made available by the
computer.
★ Manages Resources
The OS makes sure all parts of the computer work smoothly together. It
controls:
Operating systems have changed a lot from the early days when
computers could only run one task at a time. Now, we have super-fast,
multi-user systems that can do tons of things at once.
● Batch Processing
➔ After they would submit the jobs to the computer, a new piece of
software called the monitor would schedule jobs to be executed as
fast as possible.
➔ The jobs would run until they either successfully ended or if an error
occurred, at which time the monitor would immediately load the next
program in a batch.
Pros:
● Efficient for large tasks
● No need for constant user input
● Works well for scheduled jobs (e.g., payroll processing, bill
generation)
Cons:
● Can’t change tasks while they’re running
● If one job has an error, the whole batch might stop
Pros:
Fast Response Time
Highly Reliable
Cons:
Expensive to Develop because it requires specialized software &
hardware.
Requires High Maintenance cause it needs to be updated and
monitored
Complex to Design because it must be carefully programmed.
Instead of having one program being loaded into memory, as was the case
for batch processing, multiple programs are loaded in memory. Instead of
running one program at a time, the CPU switches between them to
maximize efficiency.
HOW IT WORKS?
The OS loads multiple programs into memory.
The CPU switches between programs whenever one is waiting (e.g., for
input/output).
This reduces CPU idle time, increasing system efficiency.
Pros:
Better CPU utilization (less idle time)
Faster processing (more tasks running at once)
Efficient multitasking
Cons:
Needs more memory (RAM) to store multiple programs
More complex OS to manage multiple tasks
Slower response for individual tasks since CPU is shared
Example of Multiprogramming
Imagine you’re:
Downloading a file
Watching a video
Typing a document
HOW IT WORKS
The system has two or more processors (CPUs).
The OS divides tasks among the processors.
Each processor works independently or together to complete tasks faster.
Pros:
Faster processing since tasks run in parallel.
Better performance for heavy applications like gaming and AI.
More reliable – If one processor fails, others can still work.
Cons:
Expensive hardware – Needs multiple CPUs.
More complex OS to manage multiple processors.
Not all programs use multiple CPUs efficiently.
Example of Multiprocessing
Imagine a restaurant kitchen :
Since multiple chefs (processors) are working at the same time, the food
gets prepared much faster than if only one chef was doing everything
Example:
When you turn on your Windows PC, the BIOS loads the Windows boot
manager, which then loads the Windows OS into memory, allowing you to
use your computer.
There are two principle methods on OS control processes which are the
two state and three state process management models. The two-way
model is where each process is assigned a status as to where it is running
or not which are designated as Running and Not Running. The OS
manages and maintains the status of all processes in the system by
tracking their status as being either Running or Not Running.
Process states: Running, Ready, Blocked.
Running: this is the state of the process that is currently being executed.
Ready: This is the state of a process that is queuing, prepared and waiting
to be executed when given the opportunity.
Blocked: A process that cannot execute until some events occurs such as
the completion of an I/O operation.
A process is in one and only one of the three states . For a single
processor computer, only one process can be in the RUNNING state at any
one instant. There can be many processes in the READY and BLOCKED
states and each of these states will have an associated queue for
processes.
I/O Interrupts
Triggered when input/output (I/O) operations are completed.
Example: When a file finishes downloading or a printer completes a job.
Hardware Interrupts
Generated by hardware devices like the keyboard, mouse, printer, or
network card.
Example: Pressing a key on the keyboard or moving the mouse sends an
interrupt to the CPU.
Software Interrupts
Generated by programs when they need OS services (system calls).
Example: When a program requests to open a file or allocate memory.
Deadlock and Deadlock Resolution
A deadlock happens when two or more processes get stuck waiting for
resources that another process is holding. As a result, none of them can
continue, and the system gets stuck. Typically more than one processes
are involved in deadlock and this is called deadly embrace. This situation
comes in place if all of the following conditions holds simultaneously in the
system:
Mutual Exclusion: It means only one process can use a resources at any
given.
Hold and wait: A process is currently holding at least one resource and
requesting to use resources held by other processes.
Circular Wait: A process waiting for a resource which is being held by
another process which in turn is waiting for the first process to release the
resource.
No Pre-emption: The operating system must not deallocate resources
once they have been allocated.
In a computer, this happens when two programs need the same resources
but won’t let go, causing a system freeze.
Process Control Block
The CPU does not interrupt a running process; it must complete before
the next process starts.
Memory Management
VIRTUAL MEMORY
PAGING
THRASHING
Thrashing occurs when a computer spends too much time swapping data
between RAM and disk (virtual memory) instead of executing tasks. This
happens when there’s not enough RAM, and the system continuously
moves pages in and out of memory, slowing everything down.
File Management
🔹 Types of Directories:
✔ Single-Level Directory – All files stored in one place (simple but hard to
manage).
✔ Two-Level Directory – Each user has a separate directory.
✔ Tree Directory – A hierarchical structure (like Windows Explorer).
✔ Acyclic/Graph Directory – Allows shared folders (links) for better
organization.
FILES
File Operation
✔Create
✔Read
✔ Write
✔ Rename
✔ Delete
✔ Copy
✔Move
File Compression
File compression reduces file size to save storage and speed up transfers.
It works by removing redundant data.
TYPES OF COMPRESSION
Example:
ZIP & RAR files compress multiple files into one, reducing size.
MP3 & JPEG reduce file size by removing unneeded details.
Security of Files
File security ensures that only authorized users can access, modify, or
delete files. The operating system uses various methods to protect
sensitive data from unauthorized access, loss, or corruption.
USER ID
🔹 Example:
PASSWORD
A password is a secret code required to access a user account or a
protected file.
🔹 Example:
🔹 Types of Permissions:
✔ Read (R) – User can view the file but not change it.
✔ Write (W) – User can modify or delete the file.
✔ Execute (X) – User can run the file (for programs or scripts).
FILE ENCRYPTION
Encryption converts files into unreadable code that can only be accessed
with a decryption key or password.
🔹 Types of Encryption:
✔ Symmetric Encryption – Uses one key to encrypt & decrypt (fast but less
secure).
✔ Asymmetric Encryption – Uses two keys (public & private) for better
security.
Example:
Activity logs record who accessed or modified files and when. They help
detect security breaches and unauthorized access.
🔹 Example:
User Interface
A User Interface (UI) is the way a user interacts with the operating system.
It allows users to run programs, manage files, and configure settings
through different input methods.
TYPES OF INTERFACE
Command-line Interface
A text-based interface where users type commands to interact with the OS.
Requires exact syntax to execute tasks.
Pros:
✔ Fast & powerful for advanced users.
✔ Low system resources required.
✔ Great for automation (scripts & batch files).
Cons:
Example:
MENU-DRIVEN INTERFACE
Users interact with a list of options (menus) instead of typing commands.
Used in ATMs, vending machines, older mobile phones, BIOS settings.
Pros:
✔ Simple & easy to use.
✔ No need to memorize commands.
Cons:
Limited flexibility compared to CLI.
Slower for advanced users.
Example:
Pros:
✔ User-friendly (drag & drop, click to open).
✔ Easy multitasking with multiple windows.
Cons:
Uses more RAM & processing power.
Slower for advanced users compared to CLI.
Example:
Windows (File Explorer, Start Menu).
macOS (Dock, Finder).
Linux (GNOME, KDE).
MANIPULATION OF INTERFACE
Customization
Users can change themes, icons, fonts, and layouts to make the interface
more personal.
Keyboard Shortcuts
Used to navigate faster (e.g., Ctrl + C to copy, Alt + Tab to switch apps).
DEVICE DRIVERS
Example:
Types of Interrupts:
✔ Hardware Interrupt – Triggered by external devices (e.g., pressing a key on
a keyboard).
✔ Software Interrupt – Generated by a running program (e.g., divide by zero
error).
When an interrupt occurs, the OS saves the current process in the PCB.
The OS then switches to handling the interrupt before returning to the
previous task.
Example:
A mouse click is input, and the cursor movement on the screen is output.
PERIPHERAL CONTROL
Functions:
✔ Detects when a new device is connected.
✔ Installs necessary drivers for communication.
✔ Controls data flow between the device and the computer.
Example:
When you plug in a USB flash drive, the OS detects and mounts it for use.
Which is better?
Buffering
A temporary storage area where data is held before being processed.
Speeds up communication between slow & fast devices.
Example:
When streaming a video, a buffer stores data to prevent lag if the
connection slows down.
Example:
If multiple users send print jobs, spooling queues them instead of blocking
the printer.
Network Management
Network management in an OS involves controlling and monitoring
network resources, such as user accounts, access logs, and security
settings.
User Accounts
The OS manages user authentication and permissions for network access.
Users may have different levels of access (e.g., Admin, Standard User,
Guest).
Account details include username, password, and privileges.
Example:
Access Logs
Logs keep records of who accessed the network, when, and what they did.
Helps track unauthorized access and detect security breaches.
Example:
A company logs failed login attempts to detect hacking attempts.
Websites log IP addresses of visitors for security and analytics.
Networking Protocols
Example:
When you send an email, TCP ensures it arrives fully, and IP finds the
fastest route to the recipient
References