Unit 2 - Operating - System
Unit 2 - Operating - System
Polytechnic
Ranaghat, Nadia
2.5 Booting
Although Mac, Unix, Linux, Windows, and other OS do not have the same structure, most of
the operating systems share similar OS system components like File, Process, Memory, I/O
device management.
• File Management
• Process Management
• I/O Device Management
• Network Management
• Main Memory management
• Secondary-Storage Management
• Security Management
• Other Important Activities
File Management
A file is a set of related information which is should define by its creator. It commonly
represents programs, both source and object forms, and data. Data files can be numeric,
alphabetic, or alphanumeric.
The operating system has the following important given activities in connections with file
management:
Process Management
The process management component is a procedure for managing the many processes that are
running simultaneously on the operating system. Every software application program has one
or more processes associated with them when they are running.
For example, when you use a browser like Google Chrome, there is a process running for that
browser program. The OS also has many processes running, which performing various
functions.
All these processes should be managed by process management, which keeps processes for
running efficiently. It also uses memory allocated to them and shutting them down when
needed.
The execution of a process must be sequential so, at least one instruction should be executed
on behalf of the process.
One of the important uses of an operating system that helps you to hide the variations of
specific hardware devices from the user.
The computers in the network are connected through a communication network, which can be
configured in a number of different ways. With the help of network management, the network
can be fully or partially connected, which helps users to design routing and connection
strategies that overcome connection and security issues.
• Distributed systems help you to various computing resources in size and function. They may
involve microprocessors, minicomputers, and many general-purpose computer systems.
• A distributed system also offers the user access to the various resources the network shares.
• It helps to access shared resources that help computation to speed-up or offers data
availability and reliability.
Main Memory is a large array of storage or bytes, which has an address. The memory
management process is conducted by using a sequence of reads or writes of specific memory
addresses.
In order to execute a program, it should be mapped to absolute addresses and loaded inside
the Memory. The selection of a memory management method depends on several factors.
However, it is mainly based on the hardware design of the system. Each algorithm requires
corresponding hardware support. Main Memory offers fast storage that can be accessed
directly by the CPU. It is costly and hence has a lower storage capacity. However, for a
program to be executed, it must be in the main Memory.
This Memory of the computer is very small to store all data and programs permanently. The
computer system offers secondary storage to back up the main Memory. Today modern
computers use hard drives/SSD as the primary storage of both programs and data. However,
the secondary storage management also works with storage devices, like a USB flash drive,
and CD/DVD drives.
Programs like assemblers, compilers, stored on the disk until it is loaded into memory, and
then use the disk as a source and destination for processing.
• Storage allocation
• Free space management
• Disk scheduling
Security Management
The various processes in an operating system need to be secured from each other's activities.
For that purpose, various mechanisms can be used to ensure that those processes which want
to operate files, memory CPU, and other hardware resources should have proper
authorization from the operating system.
For example, Memory addressing hardware helps you to confirm that a process can be
executed within its own address space. The time ensures that no process has control of the
CPU without renouncing it.
Lastly, no process is allowed to do its own I/O, to protect, which helps you to keep the
integrity of the various peripheral devices.
• The user's program can't execute I/O operations directly. The operating system should
provide some medium to perform this.
• OS checks the capability of the program to read, write, create, and delete files.
• OS facilitates an exchange of information between processes executing on the same or
different systems.
• OS components help you to makes sure that you get the correct computing by
detecting errors in the CPU and memory hardware.
• An operating system is a large and complex system that can only be created by
partitioning into small pieces.
• Operating system shares the various OS system components like File, Process
Memory, I/O device management, etc.
• A file is a collection of related information which is should define by its creator.
• The process management component is a procedure for managing the many processes
that are running simultaneously on the operating system
• I/O device management is one of the important use of an operating system that helps
you to hide the variations of specific hardware devices from the user.
• Network management is the process of administering and managing computer
networks.
• The memory management process is conducted by using a sequence of reads or writes
of certain memory addresses.
• Secondary-Storage Management, the most important task of a computer system, is to
execute programs.
• Security management includes various processes in an operating system that need to
be secured from each other's activities.
• The operating system checks the capability of the program to read, write, create, and
delete files.
• Program execution
• I/O operations
• File System manipulation
• Communication
• Error Detection
• Resource Allocation
• Protection
Program execution
Operating systems handle many kinds of activities from user programs to system programs
like printer spooler, name servers, file server, etc. Each of these activities is encapsulated as a
process.
A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating system with
respect to program management −
I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers
hide the peculiarities of specific hardware devices from the users.
An Operating System manages the communication between user and device drivers.
• I/O operation means read or write operation with any file or any specific I/O device.
• Operating system provides the access to the required I/O device when required.
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions. Following are the major activities of an
operating system with respect to file management −
Communication
In case of distributed systems which are a collection of processors that do not share memory,
peripheral devices, or a clock, the operating system manages communications between all the
processes. Multiple processes communicate with one another through communication lines in
the network.
The OS handles routing and connection strategies, and the problems of contention and
security. Following are the major activities of an operating system with respect to
communication −
Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the
memory hardware. Following are the major activities of an operating system with respect to
error handling −
Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU
cycles and files storage are to be allocated to each user or job. Following are the major
activities of an operating system with respect to resource management −
Protection
Considering a computer system having multiple users and concurrent execution of multiple
processes, the various processes must be protected from each other's activities.
The major operations of the operating system are process management, memory
management, device management and file management. These are given in detail as follows:
There are many scheduling queues that are used to handle processes in process management.
When the processes enter the system, they are put into the job queue. The processes that are
ready to execute in the main memory are kept in the ready queue. The processes that are
waiting for the I/O device are kept in the device queue.
Memory Management
Memory management plays an important part in operating system. It deals with memory and
the moving of processes from disk to primary memory for execution and back again.
The activities performed by the operating system for memory management are −
• The operating system assigns memory to the processes as required. This can be done using
best fit, first fit and worst fit algorithms.
• All the memory is tracked by the operating system i.e. it nodes what memory parts are in
use by the processes and which are empty.
• The operating system deallocated memory from processes as required. This may happen
when a process has been terminated or if it no longer needs the memory.
File Management
Files are used to provide a uniform view of data storage by the operating system. All the files
are mapped onto physical devices that are usually non-volatile so data is safe in the case of
system failure.
The files can be accessed by the system in two ways i.e. sequential access and direct access −
• Sequential Access
The information in a file is processed in order using sequential access. The files
records are accessed on after another. Most of the file systems such as editors,
compilers etc. use sequential access.
• Direct Access
In direct access or relative access, the files can be accessed in random for read and
write operations. The direct access model is based on the disk model of a file, since it
allows random accesses.
1. Process control: end, abort, create, terminate, allocate and free memory.
2. File management: create, open, close, delete, read file etc.
3. Device management
4. Information maintenance
5. Communication
Windows Unix
CreateProcess() fork()
Process Control ExitProcess() exit()
WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
File Manipulation WriteFile() write()
CloseHandle() close()
GetCurrentProcessID() getpid()
Information Maintenance SetTimer() alarm()
Sleep() sleep()
CreatePipe() pipe()
Communication CreateFileMapping() shmget()
MapViewOfFile() mmap()
SetFileSecurity() chmod()
Protection InitlializeSecurityDescriptor() umask()
SetSecurityDescriptorGroup() chown()
An error in one program can adversely affect many processes, it might modify data of another
program, or also can affect the operating system. For example, if a process stuck in infinite
loop then this infinite loop could affect correct operation of other processes. So, to ensure the
proper execution of the operating system, there are two modes of operation:
User mode –
When the computer system run user applications like creating a text document or using any
application program, then the system is in the user mode. When the user application requests
for a service from the operating system or an interrupt occurs or system call, then there will
be a transition from user to kernel mode to fulfil the requests.
Note: To switch from kernel mode to user mode, mode bit should be 1.
Kernel Mode –
When the system boots, hardware starts in kernel mode and when operating system is loaded,
it starts user application in user mode. To provide protection to the hardware, we have
privileged instructions which execute only in kernel mode. If user attempt to run privileged
1. Handling Interrupts
2. To switch from user mode to kernel mode.
3. Input-Output management.
Simple Structure
There are many operating systems that have a rather simple structure. These started as small
systems and rapidly expanded much further than their scope. A common example of this is
MS-DOS. It was designed simply for a niche amount for people. There was no indication that
it would become so popular.
It is better that operating systems have a modular structure, unlike MS-DOS. That would lead
to greater control over the computer system and its various applications. The modular
structure would also allow the programmers to hide information as required and implement
internal routines as they see fit without changing the outer specifications.
• Operating systems such as MS-DOS and the original UNIX did not have well-defined
structures.
Layered Structure
One way to achieve modularity in the operating system is the layered approach. In this, the
bottom layer is the hardware and the topmost layer is the user interface.
As seen from the image, each upper layer is built on the bottom layer. All the layers hide
some structures, operations etc from their upper layers.
One problem with the layered structure is that each layer needs to be carefully defined. This
is necessary because the upper layers can only use the functionalities of the layers below
them.
• This allows implementers to change the inner workings, and increases modularity.
• As long as the external interface of the routines don’t change, developers have more
freedom to change the inner workings of the routines.
• With the layered approach, the bottom layer is the hardware, while the highest layer is
the user interface.
o The main advantage is simplicity of construction and debugging.
o The main difficulty is defining the various layers.
o The main disadvantage is that the OS tends to be less efficient than other
implementations.
Monolithic Approach
• Functionality of the OS is invoked with simple function calls within the kernel, which is one
large program.
• Device drivers are loaded into the running kernel and become part of the kernel.
Microkernels
This structures the operating system by removing all nonessential portions of the kernel and
implementing them as system and user level programs.
Main disadvantage is poor performance due to increased system overhead from message
passing.
A Microkernel architecture.
The BIOS, operating system and hardware components of a computer system should all be
working correctly for it to boot. If any of these elements fail, it leads to a failed boot
sequence.
Location Of BIOS:
BIOS is typically placed in a chip known as Read Only Memory (ROM) that comes with the
computer. This ensures that the BIOS will always be available even if the hard disk is
formatted or replaced. However, in many cases the content of the ROM is transferred to the
RAM when the system is started. This is because the RAM allows quicker access as
compared to the ROM. Copying of the content of the ROM to the RAM is known as
shadowing.
• The CPU initializes itself after the power in the computer is first turned on. This is
done by triggering a series of clock ticks that are generated by the system clock.
• After this, the CPU looks for the system’s ROM BIOS to obtain the first instruction in
the start-up program. This first instruction is stored in the ROM BIOS and it instructs
the system to run POST (Power on Self-Test) in a memory address that is
predetermined.
• POST first checks the BIOS chip and then the CMOS RAM. If there is no battery
failure detected by POST, then it continues to initialize the CPU.
• POST also checks the hardware devices, secondary storage devices such as hard
drives, ports etc. And other hardware devices such as the mouse and keyboard. This is
done to make sure they are working properly.
• After POST makes sure that all the components are working properly, then the BIOS
finds an operating system to load.
• In most computer systems, the operating system loads from the C drive onto the hard
drive. The CMOS chip typically tells the BIOS where the operating system is found.
• The order of the different drives that CMOS looks at while finding the operating
system is known as the boot sequence. This sequence can be changed by changing the
CMOS setup.
• After finding the appropriate boot drive, the BIOS first finds the boot record which
tells it to find the beginning of the operating system.
• After the initialization of the operating system, the BIOS copies the files into the
memory. Then the operating system controls the boot process.
• In the end, the operating system does a final inventory of the system memory and
loads the device drivers needed to control the peripheral devices.
• The users can access the system applications to perform various tasks.
Without the system boot process, the computer users would have to download all the
software components, including the ones not frequently required. With the system boot, only
The operating system should be convenient, easy to use, reliable, safe and fast
according to the users. However, these specifications are not very useful as there is no
set method to achieve these goals.
The operating system should be easy to design, implement and maintain. These are
specifications required by those who create, maintain and operate the operating
system. But there is no specific method to achieve these goals as well.
Modern operating systems should be able to handle multiple users as well as multiple devices
at the same time. This is necessary for the modern multi-core architectures. Because of these
specifications, the operating system design can be quite complex and difficult to create.
Operating systems should be able to provide security and privacy for a system. This is very
important as there are many malicious users who may want to hack into the computer system
and steal user programs.
Resource Sharing
The operating system should make sure that resources are shared in a correct manner between
multiple user processes. This can get quite complex when multiple users share the same
device as well.
A major design consideration is that the operating system should be able to weather future
hardware and software changes and not become obsolete. This is necessary as the operating
system being changed again and again is quite a costly process.
The operating systems should be portable i.e. they should work with different hardware and
machines. There may be some speciality operating system that only work on one kind of
machine, however, most of them are portable.
The new operating systems created should be compatible with the previous models i.e. they
should contain backward compatibility.
Operating systems should be developed keeping in mind a general user base so that many
users can use them. Even specially developed operating systems that target a single user base
contain generality.
Reference