Week V
Week V
An Operating System (OS) is a collection of software that manages computer hardware resources
and provides common services for computer programs. When you start using a Computer System
then it's the Operating System (OS) which acts as an interface between you and the computer
hardware. The operating system is really a low-level Software which is categorized as a System
Software and supports a computer's basic functions, such as memory management, tasks
scheduling and controlling peripherals etc.
An Operating System (OS) is an interface between a computer user and computer hardware. An
operating system is a software which performs all the basic tasks like file management, memory
management, process management, handling input and output, and controlling peripheral devices
such as disk drives and printers.
Computer Users are the users who use the overall computer system.
Application Software’s are the softwares which users use directly to perform different
activities. These softwares are simple and easy to use like Browsers, Word, Excel,
different Editors, Games etc. These are usually written in high-level languages, such as
Python, Java and C++.
System Softwares are the softwares which are more complex in nature and they are more
near to computer hardware. These software are usually written in low-level languages
like assembly language and includes Operating Systems (Microsoft Windows, macOS,
and Linux), Compiler, and Assembler etc.
Computer Hardware includes Monitor, Keyboard, CPU, Disks, Memory, etc.
If we consider a Computer Hardware is body of the Computer System, then we can say an
Operating System is its soul which brings it alive ie. operational. We can never use a Computer
System if it does not have an Operating System installed on it.
1|Page
There are plenty of Operating Systems available in the market which include paid and unpaid
(Open Source). Following are the examples of the few most popular Operating Systems:
Windows: This is one of the most popular and commercial operating systems developed
and marketed by Microsoft. It has different versions in the market like Windows 8,
Windows 10 etc and most of them are paid.
Linux This is a Unix based and the most loved operating system first released on
September 17, 1991 by Linus Torvalds. Today, it has 30+ variants available like Fedora,
OpenSUSE, CentOS, UBuntu etc. Most of them are available free of charges though you
can have their enterprise versions by paying a nominal license fee.
MacOS This is again a kind of Unix operating system developed and marketed by Apple
Inc. since 2001.
iOS This is a mobile operating system created and developed by Apple Inc. exclusively
for its mobile devices like iPhone and iPad etc.
Android This is a mobile Operating System based on a modified version of the Linux
kernel and other open source software, designed primarily for touchscreen mobile devices
such as smartphones and tablets.
Some other old but popular Operating Systems include Solaris, VMS, OS/400, AIX, z/OS, etc.
Process Management
Input/Output Device Management
File Management
Network Management
Main Memory Management
Secondary Storage Management
Security Management
Command Interpreter System
Control over system performance.
Job Accounting
Error Detection and Correction
Coordination between other software and users
Many more other important tasks
Operating systems have been evolving through the years. In the 1950s, computers were limited
to running one program at a time like a calculator, but later in the following decades, computers
began to include more and more software programs, sometimes called libraries, that formed the
basis for today’s operating systems.
2|Page
The first Operating System was created by General Motors in 1956 to run a single IBM
mainframe computer, its name was the IBM 704. IBM was the first computer manufacturer to
develop operating systems and distribute them in its computers in the 1960s.
Stanford Research Institute developed the oN-Line System (NLS) in the late 1960s,
which was the first operating system that resembled the desktop operating system we use
today.
Microsoft bought QDOS (Quick and Dirty Operating System) in 1981 and branded it as
Microsoft Operating System (MS-DOS). As of 1994, Microsoft had stopped supporting
MS-DOS.
Unix was developed in the mid-1960s by the Massachusetts Institute of Technology,
AT&T Bell Labs, and General Electric as a joint effort. Initially it was named MULTICS,
which stands for Multiplexed Operating and Computing System.
FreeBSD is also a popular UNIX derivative, originating from the BSD project at
Berkeley. All modern Macintosh computers run a modified version of FreeBSD (OS X).
Windows 95 is a consumer-oriented graphical user interface-based operating system built
on top of MS-DOS. It was released on August 24, 1995 by Microsoft as part of its
Windows 9x family of operating systems.
Solaris is a proprietary Unix operating system originally developed by Sun Microsystems
in 1991. After the Sun acquisition by Oracle in 2010 it was renamed Oracle Solaris.
If you are aspiring to become a Great Computer Programmer, then it is highly recommended to
understand how exactly an Operating System works inside out. This gives opportunity to
understand how exactly data is saved in the disk, how different processes are created and
scheduled to run by the CPU, how to interact with different I/O devices and ports.
There are various low-level concepts which help a programmer to Design and Develop scalable
softwares. Bottom line is without a good understanding of Operating System Concepts, it can't
be assumed someone to be a good Computer Application Software developer, and even it is
unimaginable imagine someone to become a System Software developer without knowing
Operating System in-depth.
If you are a fresher and applying for a job in any standard company like Google, Microsoft,
Amazon, IBM etc then it is very much possible that you will be asked questions related to
Operating System concepts.
The operating system (OS) acts as an intermediary between the hardware and software, ensuring
efficient resource utilization. Two key functions of an OS are hardware management and
multitasking. Here's a detailed breakdown of each, including scenarios and examples:
3|Page
1. Hardware Management
The OS is responsible for managing hardware components such as the CPU, memory, storage
devices, input/output (I/O) devices, and peripherals.
a. CPU Management
Function: The OS schedules processes to utilize the CPU efficiently using process
scheduling algorithms (e.g., round-robin, first-come-first-served).
Scenario: A computer running multiple applications (e.g., a browser, a music player, and
a document editor) uses the OS to allocate CPU time to each task.
Example:
o In a round-robin scheduling system, the OS assigns a time slice to each process.
For instance, if the browser takes too long loading a page, the OS will switch the
CPU to play music without user disruption.
b. Memory Management
Function: The OS allocates and deallocates memory to ensure optimal performance and
prevents memory conflicts.
Scenario: When opening multiple tabs in a web browser, the OS dynamically allocates
memory to each tab and retrieves it upon closure.
Example:
o Virtual memory allows a system to run applications exceeding the physical RAM
size by using disk space as an extension of memory.
c. Storage Management
Function: Manages data storage on hard drives, SSDs, and external drives. This includes
file systems and storage allocation.
Scenario: Saving a file in Microsoft Word involves the OS writing data to the
appropriate storage sectors.
Example:
o File systems like NTFS or FAT32 allow structured data storage and retrieval.
4|Page
e. Device Drivers
Function: These software components enable the OS to interact with hardware devices.
Scenario: Installing a graphics driver ensures the OS can utilize GPU capabilities for
rendering graphics.
Example:
o Without the correct audio driver, a system cannot output sound even if the
hardware is functional.
2. Multitasking
Types of Multitasking
1. Preemptive Multitasking:
o The OS allocates CPU time to processes and can forcibly interrupt a process to
switch to another.
o Example: Windows and Linux systems allow a media player to keep playing
music while the user types in a document.
2. Cooperative Multitasking:
o Processes voluntarily yield control of the CPU to allow others to run.
o Example: Early versions of macOS relied on cooperative multitasking.
Context Switching: The OS saves the state of the current process and loads the state of
the next process.
o Scenario: Switching between a spreadsheet application and a web browser.
o Example: The OS remembers the cursor position in Excel while the user reads an
article online.
Concurrency vs. Parallelism:
o Concurrency: Multiple processes progress simultaneously but not necessarily at
the same time.
o Parallelism: True simultaneous execution on multi-core CPUs.
o Example: Running a video rendering program on a multi-core processor enables
parallel processing.
Scenarios of Multitasking
5|Page
oA user streams a video while editing a presentation. The OS ensures the video
player and presentation software get necessary CPU cycles without one starving
the other.
2. Scenario 2: Background Services
o While browsing the internet, the OS runs antivirus software in the background,
scanning for threats without interrupting the user.
3. Scenario 3: Real-Time Operations
o A real-time operating system (RTOS) in industrial robots ensures sensors are
monitored while controlling actuators without delay.
Graphical User Interface (GUI) and Command-Line Interface (CLI) are two fundamental types
of interfaces through which users interact with computers. Each has distinct characteristics, use
cases, and benefits.
A GUI is a visual-based interface that allows users to interact with the system through graphical
elements such as windows, icons, buttons, menus, and pointers. It is designed to be intuitive and
user-friendly, often requiring minimal technical knowledge.
Key Features
Visual Elements: Icons, buttons, menus, and toolbars provide a visual representation of
tasks and tools.
Mouse and Touch Interaction: Users interact with elements using a mouse, touchpad, or
touchscreen.
Drag-and-Drop Functionality: Many GUIs support direct manipulation of files and
objects through drag-and-drop actions.
Multitasking: GUI environments allow multiple applications to run and display
simultaneously in separate windows.
6|Page
Advantages
Disadvantages
1. Resource Intensive: Requires more memory, CPU, and graphical processing power
compared to CLI.
2. Less Precise for Certain Tasks: Complex or repetitive tasks may require multiple clicks
and navigation.
Examples
Scenario
Using a GUI to copy a file involves opening a file explorer, selecting the file, right-clicking,
choosing "Copy," navigating to the destination folder, and clicking "Paste."
A CLI is a text-based interface that allows users to interact with the system by typing commands
into a terminal or command prompt. It is often preferred by advanced users and system
administrators for its speed and precision.
Key Features
Advantages
1. Efficiency: Faster for experienced users as tasks can be completed with a few commands.
2. Low Resource Usage: Consumes minimal system resources.
7|Page
3. Powerful: Allows access to advanced features and system internals not always available
in a GUI.
4. Automation: Supports scripting for repetitive or batch processes.
Disadvantages
1. Steep Learning Curve: Requires memorization of commands and syntax, which can be
intimidating for beginners.
2. Error-Prone: Mistakes in commands can lead to unintended actions, including system
errors.
3. No Visual Feedback: Does not provide visual cues or guidance, making it less intuitive.
Examples
Real-World Applications
When to Use a GUI
8|Page
Essential OS Functions: File Operations and Task Management
An operating system (OS) provides the foundation for managing the resources of a computer
system. Among its core responsibilities are file operations and task management, which are
essential for enabling users and applications to interact with the hardware and system resources
effectively. These essential OS functions are the backbone of modern operating systems,
enabling users and applications to harness the full potential of hardware and software resources.
1. File Operations
The OS manages how files are stored, retrieved, and manipulated on storage devices. A file is a
collection of related data, and the OS organizes this data into a structured file system.
1. File Creation:
o The OS allows users and applications to create files on storage devices.
o Example: When creating a new document in a text editor, the OS allocates
storage and assigns metadata (name, creation date).
2. File Opening:
o Files need to be opened before being read or modified. The OS provides access to
the file's content and ensures it is available to the application.
o Example: Opening an image file in a photo viewer.
3. File Reading:
o The OS reads data from files and delivers it to applications or users.
o Example: Streaming a video file involves reading chunks of the file from the
disk.
4. File Writing:
o Allows data to be written into files. The OS ensures data integrity during this
process.
o Example: Saving changes to a document in a word processor.
5. File Deletion:
o The OS allows files to be removed from the file system and reclaims the space for
other uses.
o Example: Deleting unwanted files to free up disk space.
9|Page
7. File Organization:
o The OS organizes files in directories or folders for easier access and management.
o Example: Storing project-related files in a single folder.
Scenario
2. Task Management
Task management refers to how the OS handles processes and programs running on the system.
A process is an instance of a program in execution, and the OS ensures efficient execution,
resource allocation, and multitasking.
2. Process Scheduling:
o The OS schedules processes to share CPU time based on priority and fairness.
o Example: Using round-robin scheduling to give equal CPU time slices to all
active processes.
3. Multitasking:
o Allows multiple processes to run concurrently by switching between them
quickly.
o Example: Listening to music while editing a document.
4. Resource Allocation:
o The OS allocates necessary resources like CPU, memory, and I/O devices to
active processes.
10 | P a g e
o Example: Assigning memory to a video player and CPU time to a game running
simultaneously.
6. Process Synchronization:
o Ensures processes do not interfere with each other, particularly in shared resource
usage.
o Example: Two programs writing to the same file at the same time.
7. Error Handling:
o Detects and resolves process errors, such as illegal memory access or
unresponsive applications.
o Example: Prompting the user to "End Task" in Windows Task Manager when a
program freezes.
Scenario
11 | P a g e