0% found this document useful (0 votes)
179 views15 pages

OS Unit - 1

The document provides an overview of Operating Systems, detailing their functions, operations, and types, including Free and Open-Source Operating Systems. It explains key concepts such as memory management, processor management, device management, and file management, along with different computing environments. Additionally, it discusses user and operating-system interfaces, highlighting various types like Command-Line Interface and Graphical User Interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views15 pages

OS Unit - 1

The document provides an overview of Operating Systems, detailing their functions, operations, and types, including Free and Open-Source Operating Systems. It explains key concepts such as memory management, processor management, device management, and file management, along with different computing environments. Additionally, it discusses user and operating-system interfaces, highlighting various types like Command-Line Interface and Graphical User Interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

II Year – II Semester Operating Systems

Operating Systems

UNIT - I

Syllabus: Operating Systems Overview: Introduction, Operating system functions, Operating systems
operations, Computing environments, Free and Open-Source Operating Systems System Structures: Operating
System Services, User and Operating-System Interface, system calls, Types of System Calls, system programs,
Operating system Design and Implementation, Operating system structure, Building and Booting an Operating
System, Operating system debugging.

Introduction:

An Operating System (OS) is an interface between computer user and computer hardware. An operating
system is 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.
Some popular Operating Systems include Linux, Windows, OS X, VMS, OS/400, AIX, z/OS, etc.

Definition: An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.

Two Views of Operating System


1. User's View
2. System View

1. User View
The user view of the computer refers to the interface being used. Such systems are designed for one user
to monopolize its resources, to maximize the work that the user is performing. In these cases, the
operating system is designed mostly for ease of use, with some attention paid to performance, and none
paid to resource utilization.

2. System View
Operating system can be viewed as a resource allocator also. A computer system consists of many
resources like - hardware and software - that must be managed efficiently. The operating system acts as
the manager of the resources, decides between conflicting requests, controls execution of programs etc.

1|Page
II Year – II Semester Operating Systems

Operating system Definition:


An operating system is a program that acts as an interface between the user and the computer hardware
and controls the execution of all kinds of programs.
Operating system functions:
Following are some of important functions of an operating System.

 Memory Management
 Processor Management
 Device Management
 File Management

 Security
 Control over system performance
 Job accounting
 Error detecting aids
 Coordination between other software and users

Memory Management: Memory management refers to management of Primary Memory or Main


Memory. Main memory is a large array of words or bytes where each word or byte has its own address.
Main memory provides a fast storage that can be accessed directly by the CPU. For a program to
be executed, it must in the main memory. An Operating System does the following activities for memory
management −
 Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not in use.
 In multiprogramming, the OS decides which process will get memory when and how much.
 Allocates the memory when a process requests it to do so.
 De-allocates the memory when a process no longer needs it or has been terminated.

Processor Management: In multiprogramming environment, the OS decides which process gets the
processor when and for how much time. This function is called process scheduling. An Operating System
does the following activities for processor management −
 Keeps tracks of processor and status of process. The program responsible for this task is known
as traffic controller.
 Allocates the processor (CPU) to a process.
 De-allocates processor when a process is no longer required.

Device Management: An Operating System manages device communication via their respective drivers. It
does the following activities for device management −
 Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.
 Decides which process gets the device when and for how much time.
 Allocates the device in the efficient way.
 De-allocates devices.

2|Page
II Year – II Semester Operating Systems

File Management: A file system is normally organized into directories for easy navigation and usage.
These directories may contain files and other directions.
An Operating System does the following activities for file management −
 Keeps track of information, location, uses, status etc. The collective facilities are often known
as file system.
 Decides who gets the resources.
 Allocates the resources.
 De-allocates the resources.

Other Important Activities: Following are some of the important activities that an Operating System
performs −
 Security − By means of password and similar other techniques, it prevents unauthorized access to
programs and data.
 Control over system performance − Recording delays between request for a service and
response from the system.
 Job accounting − Keeping track of time and resources used by various jobs and users.
 Error detecting aids − Production of dumps, traces, error messages, and other debugging and
error detecting aids.
 Coordination between other software’s and users − Coordination and assignment of compilers,
interpreters, assemblers and other software to the various users of the computer systems.

Operating systems operations:


Following are some of important operations of an operating System.

 Interrupt Handling
 Multitasking
 Dual-Mode Operation
 Virtualization

1. Interrupt Handling

Interrupts are essential for efficient OS operation, allowing it to respond promptly to critical events.

Definition

An interrupt is a signal sent to the CPU by hardware or software indicating that an event requires immediate
attention.

Types of Interrupts

 Hardware Interrupts:
o Generated by hardware devices like keyboards, mice, or disk controllers.
o Examples: A keystroke, a mouse click, or a completed disk read.
 Software Interrupts:
3|Page
II Year – II Semester Operating Systems

o Triggered by programs when they need OS services, often via system calls.
o Example: A request to read a file.

2. Multitasking

Multitasking allows the CPU to manage and execute multiple tasks (processes) simultaneously.

Definition

Multitasking is the ability of the OS to share CPU time among multiple processes, giving the illusion of parallel
execution.

Mechanism

 Time Sharing:
o The CPU divides its time into small intervals, called time slices.
o Each process gets a time slice in a cyclic order.
 Context Switching:
o The CPU saves the state of the current process and loads the state of the next process.
o This involves saving registers, program counters, and memory maps.

Types of Multitasking

 Preemptive Multitasking:
o The OS can interrupt a process to allocate the CPU to another process.
o Example: Most modern operating systems like Windows and Linux.
 Cooperative Multitasking:
o Processes voluntarily yield control of the CPU.
o Example: Older operating systems like Windows 3.x.

3. Dual-Mode Operation

Dual-mode operation ensures system security and stability by separating user activities from core OS tasks.

Definition

Dual-mode operation involves two modes:

 User Mode:
o For executing user applications with restricted access to hardware and critical resources.

 Kernel Mode:
o For executing OS-level tasks with full access to hardware.

Mechanism

 Mode Bit:
o A hardware-provided mode bit determines the current mode:
 0 for kernel mode.

4|Page
II Year – II Semester Operating Systems

 1 for user mode.


 Switching Modes:
o The OS transitions between user and kernel modes when:
 A system call is made (user → kernel).
 The user program resumes execution (kernel → user).

Example:

A file read request involves:

1. A system call from user mode.


2. Switching to kernel mode to access the disk.
3. Returning the result to user mode.

4. Virtualization

Virtualization enables the OS to simulate hardware or create isolated environments for applications.

Definition

Virtualization is the creation of a virtual version of hardware or software resources, allowing multiple operating
systems or applications to run on a single physical machine.

Types of Virtualization

 Hardware Virtualization:
o Simulates physical hardware to create multiple virtual machines (VMs).
o Example: VMware, Virtual Box.
 Application Virtualization:
o Runs applications in isolated environments.
o Example: Containers like Docker.
 Network Virtualization:
o Creates virtual network resources, such as virtual switches and routers.
 Desktop Virtualization:
o Provides virtual desktops to users over a network.

Computing environments:

A computer system uses many devices, arranged in different ways to solve many problems. This constitutes a
computing environment where many computers are used to process and exchange information to handle
multiple issues.

The different types of Computing Environments are −

5|Page
II Year – II Semester Operating Systems

1.Personal Computing Environment

In the personal computing environment, there is a single computer system. All the system processes are
available on the computer and executed there. The different devices that constitute a personal computing
environment are laptops, mobiles, printers, computer systems, scanners etc.

2.Time Sharing Computing Environment

The time sharing computing environment allows multiple users to share the system simultaneously. Each user is
provided a time slice and the processor switches rapidly among the users according to it. Because of this, each
user believes that they are the only ones using the system.

3.Client Server Computing Environment

In client server computing, the client requests a resource and the server provides that resource. A server may
serve multiple clients at the same time while a client is in contact with only one server. Both the client and
server usually communicate via a computer network but sometimes they may reside in the same system.

4.Distributed Computing Environment

A distributed computing environment contains multiple nodes that are physically separate but linked together
using the network. All the nodes in this system communicate with each other and handle processes in tandem.
Each of these nodes contains a small part of the distributed operating system software.

6|Page
II Year – II Semester Operating Systems

5.Cloud Computing Environment

The computing is moved away from individual computer systems to a cloud of computers in cloud computing
environment. The cloud users only see the service being provided and not the internal details of how the service
is provided. This is done by pooling all the computer resources and then managing them using a software.

6.Cluster Computing Environment

The clustered computing environment is similar to parallel computing environment as they both have multiple
CPUs. However a major difference is that clustered systems are created by two or more individual computer
systems merged together which then work parallel to each other.

Free and Open-Source Operating Systems:

Free and Open-Source Operating Systems (FOSS OS) play a significant role in modern computing due to their
flexibility, transparency, and cost-effectiveness.

Definition

A Free and Open-Source Operating System is software distributed under an open-source license that grants
users the freedom to:

 View and study the source code.


 Modify the software to suit their needs.
 Distribute copies of the original or modified software.

The open-source operating systems are Linux Kernel, Linux Lite, Linux mint, Fedora, Solus, Chrome OS
etc.

Linux Kernel

Linux kernel was developed by Linus Torvalds. It offers the essential functions required for an operating
system, such as data cancellation, memory processing, and interactions with computer hardware. It is open-
source software, and many developers researched the source code and produced a plethora of helpful plug-ins
and operating systems to meet their requirements.

7|Page
II Year – II Semester Operating Systems

Linux Lite

Linux Lite is a lightweight open-source operating system designed for beginners with less knowledge about
Linux-based operating systems and can be installed on any old PC and run smoothly.

Linux mint

Linux Mint is a powerful Linux-based operating system that exudes modernity and power. It is simple to use
and includes complete multimedia capabilities, making it a user-friendly open-source operating system. It is an
Ubuntu-based distribution that is popular among both beginners and experts. It is built on the Debian platform
and includes one of the most powerful software managers. It is more stable and has better visual aesthetics than
Ubuntu.

Fedora

Fedora is another popular Linux-based operating system, and it is widely considered the best open-source
operating system after Ubuntu. It is an RPM-based general-purpose operating system that is supported by Red
Hat and built by the Fedora Project community.

React OS

8|Page
II Year – II Semester Operating Systems

ReactOS is another free and open-source operating system that has nearly 1 million downloads in
over 100 countries. This community-based OS may run Windows apps, making it an excellent alternative to the
Windows operating system.

Solus

Solus is a free and open-source operating system for your desktop computer. It's a new operating system from
the Linux family, released in 2012. More than 6000 registered users are currently using the software. VLC,
XChat, Transmission, Thunderbird, OpenShot Video Editor, Firefox, Budgie desktop environment, and
LibreOffice Suite are all included with Solus.

Chrome OS

Chrome OS is a partly open-source operating system with various attractive features. It's a part of the
Chromium and Linux families, with features including better security, compatibility for supported Android and
Chrome apps, Aura windows manager, Google cloud print, integrated media player, virtual desktop access, and
cloud-based management. The only issue with the operating system is that it only supports Nexus devices or its
hardware.

Comparison:

Aspect Free and Open-Source OS Proprietary OS

Cost Free Requires licensing fees (e.g., Windows, macOS).

Customization Fully customizable Limited customization, controlled by the vendor.

Open source; anyone can inspect the


Transparency Closed source; code is hidden from users.
code

Community-driven, with optional paid


Support Vendor-provided support with costs.
support

User-friendly and designed for non-technical


Ease of Use Can have a steep learning curve
users.
Security depends on vendor updates and
Security Open review reduces vulnerabilities
patches.

9|Page
II Year – II Semester Operating Systems

Operating System Services:

 User-Oriented Services:
o Program execution, I/O operations, file system manipulation.
 System-Oriented Services:
o Resource allocation, accounting, error detection, protection and security.

User-Oriented Services:
• Program execution: The system must be able to load a program into memory and to run that
program. The program must be able to end its execution, either normally or abnormally (indicating
error).
• I/O operations: A running program may require I/O device. For specific devices, special functions
may be desired (such as recording to a CD or DVD drive). For efficiency and protection, users
usually cannot control I/O devices directly. Therefore, the operating system must provide a means to
do I/O.
• File-system manipulation: Operating System is used to control operations on files like creating,
opening, reading, and writing.

System-Oriented Services:
• Resource allocation. When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them.
• Error detection. The operating system needs to be constantly aware of possible errors. Errors may
occur in the CPU and memory, in I/O devices, and in the user program. For each type of error, the
operating system should take the appropriate action to ensure correct and consistent computing.
• Accounting: Accounting keep track of which users use how much and what kinds of computer
resources. This record keeping may be used for accounting (so that users can be billed) or simply for
accumulating usage statistics.
• Protection and security. The owners of information stored in a multiuser or networked computer
system may want to control use of that information. When several separate processes execute
concurrently, it should not be possible for one process to interfere with the others or with the
operating system itself. Protection involves ensuring that all access to system resources is controlled.
Security of the system from outsiders is also important. Such security starts with requiring each user
to authenticate himself or herself to the system, usually by means of a password, to gain access to
system resources.

User and Operating-System Interface:

The User and Operating-System Interface connects users with the operating system, enabling them to interact
and execute tasks such as file management and running applications. The three main types of interfaces are the
Command-Line Interface (CLI), Graphical User Interface (GUI), and Touch-Based Interfaces. Each serves
different purposes depending on the user's needs and the system's capabilities.

10 | P a g e
II Year – II Semester Operating Systems

1. Command-Line Interface (CLI)

The CLI allows users to type commands into a terminal to directly interact with the operating system. It is
efficient, resource-light, and suitable for advanced users who need precision and control. However, it has a
steep learning curve and requires familiarity with command syntax. CLI is commonly used by system
administrators and developers for automation and advanced tasks.

2. Graphical User Interface (GUI)

The GUI provides a user-friendly environment with visual elements like windows, icons, and menus. Users can
interact using a mouse, trackpad, or touchscreen. It is intuitive and ideal for everyday tasks, making it popular in
operating systems like Windows and macOS. While easier to use, GUI systems require more system resources
compared to CLI.

3. Touch-Based Interfaces

Touch-based interfaces are designed for devices with touchscreens, allowing users to interact through gestures
like tapping and swiping. They are common in mobile operating systems like Android and iOS, providing a
natural and intuitive experience. While user-friendly, they may lack precision and are better suited for simple
tasks rather than complex workflows.

4. Comparison of Interfaces:

Feature CLI GUI Touch-Based Interface


Ease of Use Difficult for beginners Easy and intuitive Extremely user-friendly
Resource
Minimal High Moderate to high
Usage
Task Suitable for general Limited to basic and moderate
Ideal for advanced tasks
Complexity tasks tasks
Learning
Steep Low Very low
Curve
Servers, professional
Devices Desktops, laptops Mobile devices
systems

System Calls:

In computing, a system call is the programmatic way in which a computer program requests a service
from the kernel of the operating system it is executed on. A system call is a way for programs to interact
with the operating system. A computer program makes a system call when it makes a request to the
operating system’s kernel. System call provides the services of the operating system to the user programs
via Application Program Interface (API). It provides an interface between a process and operating system
to allow user-level processes to request services of the operating system. System calls are the only entry
points into the kernel system. All programs needing resources must use system calls.

Services Provided by System Calls:


1. Process creation and management
2. Main memory management
3. File Access, Directory and File system management
4. Device handling(I/O)
5. Protection
Networking, etc

11 | P a g e
II Year – II Semester Operating Systems

Example of System Call:


 For example if we need to write a program code to read data from one file, copy that data into
another file. The first information that the program requires is the name of the two files, the input
and output files.
 First call is to write a prompting message on the screen
 Second, to read from the keyboard, the characters which define the two files.

12 | P a g e
II Year – II Semester Operating Systems

How System Call works:


Step 1) The processes executed in the user mode till the time a system call interrupts it.
Step 2) After that, the system call is executed in the kernel-mode on a priority basis.
Step 3) Once system call execution is over, control returns to the user mode.,
Step 4) The execution of user processes resumed in Kernel mode.
Why do you need System Call in OS:

 Reading and writing from files demand system calls.


 If a file system wants to create or delete files, system calls are required.

 System calls are used for the creation and management of new processes.
 Network connections need system calls for sending and receiving packets.
 Access to hardware devices like scanner, printer, need a system call.
Types of System Calls: There are 5 different types of system calls.
1. Process Control:
This system calls perform the task of process creation, process termination, etc.
 fork ( ) : This system call is used to create a new process, which is called as child
process.
 wait ( ): A call to wait() blocks the calling process until one of its child processes exits or
a signal is received.
 exit ( ): This system call terminates a process normally.
2. File Manipulation:
File management system calls handle file manipulation jobs like creating a file, reading, and
writing, etc.
 open ( ): This is used for creating and opening a file.
 read ( ): This is used to read content from specified file descriptor.
 write ( ): This is used to wrote content to specified file descriptor.
 close ( ): This is used to close opened file descriptors.
3. Device Manipulation:
Device management does the job of device manipulation like reading from device buffers,
writing into device buffers, etc.
 iocntl ( ): This system call is used to control specified I/O device.
 read ( ): This system call is used to read data from specified device.
 write ( ): This system call is used to write data to specified device.
4. Communications:
These types of system calls are specially used for interprocess communications.
 pipe ( ) : This system call sends output of one command as input of another command.
 shmget ( ): This system call is used to create a shared memory.
 shmat ( ): This system call is used to access shared memory.
5. Information Maintenance:
It handles information and its transfer between the OS and the user program
 getpid ( ): This system call is used to get the process id of the current process.
 alarm ( ): This system call only be used by a process to send a specific signal to itself.
 sleep ( ): This system call is used when user wants to halt the current process for
sometime. It keep the locks hold on resources till the sleep time is over and again
starts the execution of the process. Here process has control throughout the execution.

13 | P a g e
II Year – II Semester Operating Systems

14 | P a g e
UNIT – I Operating Systems

15

You might also like