OS-Unit-I
OS-Unit-I
• Hardware refers to the physical and visible components of the system such as a monitor, CPU, keyboard
and mouse.
• Hardware is further divided into four main categories:
Input Devices
Output Devices
Secondary Storage Devices
Internal Components
Software
• Software is a set of instructions, data or programs used to operate computers and execute specific tasks.
• Computer software is divided into two broad categories:
• System Software
• Application Software
System Software
• System software consists of programs that manage the hardware resources of a computer and perform
required information processing tasks.
• The best example for system software is OS
• Operating system:
• Examples of popular modern operating systems include Android, iOS, Linux, Mac OS X and
Microsoft Windows
• Utility programs:
Virus scanner - to protect your system from trojans and viruses
Disk defragmenter - to speed up your hard disk
System monitor - to look at your current system resources
File managers - to add, delete, rename and move files and folders
• Library programs:
• Library programs contain code and data that provide services to other programs such as interface (look
and feel), printing, network code and even the graphic engines of computer games.
• Translator software:
• Assembler - converts assembly code into machine code
• Interpreter - converts 3rd generation languages such as javascript into machine code one line at a
time
• Advantages
– 1)CPU utilization maximum
– 2)Short time jobs get executed faster
– 3)Resources are used efficiently
– 4)Response time is shorter
• Disadvantages
– 1)Difficult to program system because of complicated schedule handling
– 2)Due to high load of tasks ,long time jobs have to wait long
2.Time Sharing (Multitasking)
• Time sharing (or multitasking) is a logical extension of multiprogramming.
• CPU executes multiple jobs by switching among them
• Switches occur so frequently that the users can interact with each program while it is running
• Time sharing requires an interactive (or hands-on) computer system, which provides direct
communication between the user and the system.
• A time-shared operating system allows many users to share the computer simultaneously
• A time-shared operating system allows many users to share the computer
• Uses CPU scheduling and Multiprogramming to provide With a small portion of a time-shared
computer
• Each User has at least one separate program in memory
• A program loaded into memory and executing is called a “PROCESS”
Timer
• A timer can be set to interrupt the computer after a specified period.
• Skype is another example of peer-to-peer computing. It allows clients to make voice calls
and video calls and to send text messages over the Internet using a technology known as
voice over IP (VoIP).
Virtualization
• Virtualization is a technology that allows operating systems to run as applications within other
operating systems.
• Emulation is used when the source CPU type is different from the target CPU type.
• which allowed applications compiled for the IBM CPU to run on the Intel CPU.
Cloud Computing
• Cloud Computing is a type of computing that delivers computing, storage, and even applications as a
service across a network.
• Types of Cloud Computing
• Software as a service (SaaS)—one or more applications (such as word processors or
spreadsheets) available via the Internet.
• Example
• Google Slides
• Google Docs
• Google Sheets
• Calendar
• Program Execution - The OS must be able to load a program into RAM, run the program, and terminate the
program, either normally or abnormally.
• I/O Operations - The OS is responsible for transferring data to and from I/O devices, including keyboards,
terminals, printers, and storage devices.
• Communications - Inter-process communications, IPC, either between processes running on the same
processor, or between processes running on separate processors or separate machines. May be
implemented as either shared memory or message passing, ( or some systems may offer both)
• File-System Manipulation - the OS is also responsible for maintaining directory and subdirectory
structures, mapping file names to specific blocks of data storage, and providing tools for navigating and
utilizing the file system.
• Error Detection - Both hardware and software errors must be detected and handled appropriately, with a
minimum of harmful repercussions.
• Some systems may include complex error avoidance or recovery systems, including backups, RAID
drives, and other redundant systems. Debugging and diagnostic tools aid users and administrators in
tracing down the cause of problems.
• Other systems aid in the efficient operation of the OS itself:
• Resource Allocation - E.g. CPU cycles, main memory, storage space, and peripheral devices. Some
resources are managed with generic systems and others with very carefully designed and specially tuned
systems, customized for a particular resource and operating environment.
• Accounting - Keeping track of system activity and resource usage, either for billing purposes or for
statistical record keeping that can be used to optimize future performance.
• Protection and Security - Preventing harm to the system and to resources, either through wayward
internal processes or malicious outsiders. Authentication, ownership, and restricted access are obvious
parts of this system. Highly secure systems may log all process activity down to excruciating detail, and
security regulation dictate the storage of those records on permanent non-erasable medium for extended
times in secure ( off-site ) facilities.
Command Interpreters
Command Interpreter that allows users to directly enter commands to be performed by the
operating system.
Some operating systems include the command interpreter in the kernel.
Others such as Windows and UNIX, treat the command interpreter as a special program that is
running when a job is initiated or when a user first logs on (on interactive systems).
On systems with multiple command interpreters to choose from, the interpreters are known as
shells.
• For example, on UNIX and Linux systems, a user may choose among several different
shells, including the Bourne shell, C shell, Bourne-Again shell, Korn shell, and others
Choice of Interface
• One of personal preference.
– System administrators who manage computers and power users who have deep knowledge of a
system frequently use the command-line interface.
• For them, it is more efficient, giving them faster access to the activities they need to perform.
• Most Windows users are happy to use the Windows GUI environment and almost never use the MS-DOS
shell interface.
• The various changes undergone by the Macintosh operating systems provide a nice study in contrast.
User
mode
Kernal mode
Privileged mode
Example of a System call sequence for writing a simple program to read data from one file and copy them to
another file
• File Management
File management system calls include create file, delete file, open, close, read, write, reposition, get
file attributes, and set file attributes.
These operations may also be supported for directories as well as ordinary files.
• Device Management
Device management system calls include request device, release device, read, write, reposition, get/set
device attributes, and logically attach or detach devices.
UNIT-1 OPERATING SYSTEMS, DEPT. OF CSE, ACET, SURAMPALEM Page 13
Devices may be physical ( e.g. disk drives ), or virtual / abstract ( e.g. files, partitions, and RAM disks ).
Some systems represent devices as special files in the file system, so that accessing the "file" calls
upon the appropriate device drivers in the OS.
• Information Maintenance
Information maintenance system calls include calls to get/set the time, date, system data, and process,
file, or device attributes.
Systems may also provide the ability to dump memory at any time, single step programs pausing
execution after each instruction, and tracing the operation of programs, all of which can help to debug
programs.
• Communication
Communication system calls create/delete communication connection, send/receive messages, transfer
status information, and attach/detach remote devices.
The message passing model must support calls to:
o Identify a remote process and/or host with which to communicate.
o Establish a connection between the two processes.
o Open and close the connection as needed.
o Transmit messages along the connection.
o Wait for incoming messages, in either a blocking or non-blocking state.
o Delete the connection when no longer needed.
The shared memory model must support calls to:
o Create and access memory that is shared amongst processes ( and threads. )
o Provide locking mechanisms restricting simultaneous access.
o Free up shared memory and/or dynamically allocate it as needed.
Message passing is simpler and easier, ( particularly for inter-computer communications ), and is
generally appropriate for small amounts of data.
Shared memory is faster, and is generally the better approach where large amounts of data are to be
shared, ( particularly when most processes are reading the data rather than writing it, or at least when
only one or a small number of processes need to change any given data item. )
• Protection
Protection provides mechanisms for controlling which users / processes have access to which system
resources.
System calls allow the access mechanisms to be adjusted as needed, and for non-privileged users to be
granted elevated access permissions under carefully controlled temporary circumstances.
Simple Structure OS
• The simple structure OS has only four layers although it is not a layered OS .
• The MS DOS ( Disk Operating System ) was based on the simple structure .
•
Monolithic Kernel Operating Systems
Kernel:
• The OS consist of number of components and the core software components of an operating
system are collectively called as the kernel.
• The kernel components include system software components that manages file system , Inter process
communication , Input and output , Device Management and process Management.
• The kernel has unrestricted access and also responsible to manage all of
the resources of the computer system.
• In monolithic architecture operating systems , each layer of the operating system communicates only
with the layer immediately placed above and below it .
• In this architecture , the lower-level layers provide services to higher-level ones using an interface that
hides their implementation.
• And therefore , the Applications had access and could communicate directly with any internal component
of the operating system which gave unrestricted system access .
• This kind of layered design was perceived to be very efficient but at the same time more
vulnerable for system crash due to unrestricted system access.
Layered Approach OS
• The lack of well defined layers and the modules was problem area for simple structure OS . To overcome
these limitations, the next generation of operating systems adopted a layered Architecture approach of
operating system developed in 1960’s.
• In layered approach based OS , the operating system components are grouped in layers based on the
functionality of these components . The bottom layer ( layer 0 ) is the hardware layer and the topmost
layer ( layer n ).
• In layered approach OS architecture , each top layer can use immediate bottom layer . And therefore , the
functionality of the each layer needs to carefully designed and implemented in each layer
Microkernel Approach OS
• In case of micro-kernel architecture , the kernel components includes only a very small number of bare
minimum essential services within the kernel space in order to keep the kernel design small and
scalable.
• The services within the micro-kernel area typically include low-level memory management, inter-
process communication and basic process synchronization to enable processes to cooperate.
• This kind of micro-kernel design was observed to be more stable and at the same time less
vulnerable for system crash caused due to unrestricted system access.
• In micro-kernel architecture design based operating systems , only critical components are placed inside
kernel area .
• And other operating system components such as process management and device management are
placed outside kernel area which execute outside the kernel within a user area with lower level
of system access.
Module based OS
• The best current methodology for operating-system design involves using loadable kernel modules.
• Here, the kernel has a set of core components and links in additional services via modules, either at boot
time or during run time.
• This type of design is common in modern implementations of UNIX, such as Solaris, Linux, and Mac OS X,
as well as Windows.
• A layered system in that each kernel section has defined, protected interfaces; but it is more flexible than
a layered system, because any module can call any other module.
• The approach is also similar to the microkernel approach in that the primary module has only core
functions and knowledge of how to load and communicate with other modules; but it is more efficient,
because modules do not need to invoke message passing in order to communicate
iOS
• The iOS operating system was developed by Apple for iPhones and iPads. It runs with less memory and
computing power needs than Max OS X, and supports touchscreen interface and graphics for small
screens: