0% found this document useful (0 votes)
2 views

Ch-1 Introduction to Operating System

An Operating System (OS) serves as an interface between users and computer hardware, managing resources and enabling application interaction. The document outlines the evolution of operating systems through various generations, detailing their functions such as memory, processor, device, and file management. It also discusses user interface design, system calls, and the differences between UI and UX, highlighting the importance of effective UI design in enhancing user experience.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Ch-1 Introduction to Operating System

An Operating System (OS) serves as an interface between users and computer hardware, managing resources and enabling application interaction. The document outlines the evolution of operating systems through various generations, detailing their functions such as memory, processor, device, and file management. It also discusses user interface design, system calls, and the differences between UI and UX, highlighting the importance of effective UI design in enhancing user experience.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Ch-1 Introduction to Operating System

Operating System :
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.

An operating system is software that enables applications to interact with a


computer's hardware. The software that contains the core components of the
operating system is called the kernel.

The primary purposes of an Operating System are to enable applications


(software’s) to interact with a computer's hardware and to manage a system's
hardware and software resources.

Some popular Operating Systems include Linux Operating System, Windows


Operating System, VMS, OS/400, AIX, z/OS, etc. Today, Operating systems is
found almost in every device like mobile phones, personal computers, mainframe
computers, automobiles, TV, Toys etc.

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.

An operating system (OS) is system software that manages computer hardware,


software resources, and provides common services for computer programs.

1
Operating System Generations
Operating systems have been evolving over the years. We can categorise this
evaluation based on different generations which is briefed below:

0th Generation

The term 0th generation is used to refer to the period of development of computing
when Charles Babbage invented the Analytical Engine and later John Atanasoff
created a computer in 1940. The hardware component technology of this period
was electronic vacuum tubes. There was no Operating System available for this
generation computer and computer programs were written in machine language.
This computers in this generation were inefficient and dependent on the varying
competencies of the individual programmer as operators.

First Generation (1951-1956)

The first generation marked the beginning of commercial computing including


the introduction of Eckert and Mauchly’s UNIVAC I in early 1951, and a bit later,
the IBM 701.

System operation was performed with the help of expert operators and without
the benefit of an operating system for a time though programs began to be written
in higher level, procedure-oriented languages, and thus the operator’s routine
expanded. Later mono-programmed operating system was developed, which
eliminated some of the human intervention in running job and provided
programmers with a number of desirable functions. These systems still continued
to operate under the control of a human operator who used to follow a number of
steps to execute a program. Programming language like FORTRAN was
developed by John W. Backus in 1956.

Second Generation (1956-1964)

The second generation of computer hardware was most notably characterised by


transistors replacing vacuum tubes as the hardware component technology. The
first operating system GMOS was developed by the IBM computer. GMOS was
based on single stream batch processing system, because it collects all similar
jobs in groups or batches and then submits the jobs to the operating system using
a punch card to complete all jobs in a machine. Operating system is cleaned after
completing one job and then continues to read and initiates the next job in punch
card.

2
Researchers began to experiment with multiprogramming and multiprocessing in
their computing services called the time-sharing system. A noteworthy example
is the Compatible Time Sharing System (CTSS), developed at MIT during the
early 1960s.

Third Generation (1964-1979)

The third generation officially began in April 1964 with IBM’s announcement of
its System/360 family of computers. Hardware technology began to use
integrated circuits (ICs) which yielded significant advantages in both speed and
economy.

Operating system development continued with the introduction and widespread


adoption of multiprogramming. The idea of taking fuller advantage of the
computer’s data channel I/O capabilities continued to develop.

Another progress which leads to developing of personal computers in fourth


generation is a new development of minicomputers with DEC PDP-1. The third
generation was an exciting time, indeed, for the development of both computer
hardware and the accompanying operating system.

Fourth Generation (1979 – Present)

The fourth generation is characterised by the appearance of the personal computer


and the workstation. The component technology of the third generation, was
replaced by very large scale integration (VLSI). Many Operating Systems which
we are using today like Windows, Linux, MacOS etc developed in the fourth
generation.

3
Following are some of important functions of an operating System.

 Memory Management
 Processor Management
 Device Management
 File Management
 Network 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.

4
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.

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.

Operating System Scheduling algorithms


A Process Scheduler schedules different processes to be assigned to the CPU
based on particular scheduling algorithms. There are six popular process
scheduling algorithms which we are going to discuss in this chapter −

 First-Come, First-Served (FCFS) Scheduling


 Shortest-Job-Next (SJN) Scheduling
 Priority Scheduling
 Shortest Remaining Time
 Round Robin(RR) Scheduling
 Multiple-Level Queues Scheduling

NFS and CIFS


1. Network File System (NFS)
NFS is a network introduced by Sun Microsystems and is used by Unix or
Linux-based operating systems and stands for Network File System. This is a
network that is used for giving remote access capabilities to the applications.
5
Remote access enables the user to edit or even take a closer look at his computer
by using another computer. Old files can be repaired even when the user is at a
distance from his computer. This protocol gives devices the functionality to
modify the data over a network.

Advantages of NFS

 High Scalability: NFS is highly scalable and particularly to support large-


scale networks therefore is good for use in environments where performance
and speed are important.
 Easy Implementation: Compared to other DBMSs, NFS is quite easy to
install and fast in returning its queries.
 Transport-Dependent: NFS possesses a capability of higher
communication speed due to the fact that it is transport-dependent.

Disadvantages of NFS

 Security Limitations: Security of NFS is not up to mark thus it can be


considered less secure in environments where security of data is of
paramount importance.
 Limited OS Support: NFS is optimized for the Unix and Linux as
its operating systems, which may not produce seamless interoperability in
the networks with other operating system.

2. Common Internet File System (CIFS)

CIFS is a Windows-based network for file sharing and is used in devices that
run on Windows OS. CIFS was introduced as the public version of Server
Message Block which was invented by Microsoft. This is a very efficient feature
that enables the devices to share multiple devices that are printers and even
multiple ports for the user and administration. CIFS also enables a request for
accessing files of another computer that is connected to the server. Then this
request is served by the server to the requested client. CIFS supports huge data
companies to ensure that their data is used by the employees at multiple
locations.

Advantages of CIFS

1. Enhanced Security: CIFS provides more security features than NFS,


making it suitable for environments where data protection is critical.
2. Session Support: CIFS supports sessions, allowing for more organized and
secure communication between devices.

6
3. Wide OS Support: CIFS is ideal for networks that rely on Windows-based
systems.

Disadvantages of CIFS

 Complex Implementation: CIFS can be more challenging to implement and


configure, especially when dealing with faults.
 Lower Scalability: CIFS is less scalable and offers moderate speed
compared to NFS.

User Interface (UI)

User Interface (UI) Design shapes the user’s digital experience. From websites
to mobile apps, UI design encompasses the visual and interactive elements that
users engage with. A well-crafted UI not only enhances usability but also
communicates the brand’s identity and values. In this article, we delve into the
fundamentals of UI design, its importance, and the impact it has on user
engagement and satisfaction.

UI primarily carries out two tasks:


 Accepting user input.
 Showing the results.

What is a User Interface?

User Interface (UI) defines the way humans interact with the information
systems. In Layman’s terms, User Interface (UI) is a series of pages, screens,
buttons, forms, and other visual elements that are used to interact with the
device. Every app and every website has a user interface. User Interface (UI)
Design is the creation of graphics, illustrations, and the use of photographic
artwork and typography to enhance the display and layout of a digital product
within its various device views.
Interface elements consist of input controls (buttons, drop-down menus, data
fields), navigational components (search fields, slider, icons,
tags), and informational components (progress bars, notifications, message
boxes).

7
Types of UI Design

There are several types of User Interface (UI) depending upon the interaction
between users and computers or electronic devices in different ways. Some
common types of User Interface (UI) are:

 GUI (Graphical User Interface): Visual user interface output (keyboard


and monitor) with a tactile user interface input.
 Menu Driven Interface: An UI that uses a menu of options to navigate a
program or website is known as a menu-driven UI. For instance, ATMs have
user interfaces that are menu-driven and simple to use.
 Form Based Interface: Form-based user interfaces provide a small number
of options for users to choose from when entering data into a program or
application. For instance, a device’s settings menu is form-based.
 Touch user interface: Haptic or tactile user interface. Haptic input is used
by most smartphones, tablets, and other devices with touch screens.
 Voice user interface: Auditory commands are used to communicate
between humans and machines. GPS, talk-to-text gadgets, and virtual
assistants are a few examples.

As the User Interface can make or break the incoming users, it’s important to
take care of below points when designing a UI:

 Keep the interface simple: Clear and simple interface are best. Avoid
unnecessary elements. Best interfaces are invisible to user.
 Be consistent and use common UI elements: Using common elements,
users feel more comfortable and are able to get things done more quickly.
Create pattern to facilitate efficiency.
 Placement of items: To draw attention to most important pieces of
information careful placement of items is necessary. This can improve users
readability and engage them.
 Use of right color: To direct attention towards something take advantage of
color, light, shade, contrast and texture. It’s important top make use of good
color combination as a bad color combination can easily distract or irritate a
user.
 Anticipate: Make the user to work less by having pre-chosen fields, reduce
the burden on the user, and anticipate the goals of the users who come to
your site. The things which can be mostly searched by the users are presented
so that the users need not to work to search for it.

8
Advantages of UI Design

Some advantages of UI design are mentioned below:


 No need to learn complex commands/languages for working with UI.
 Easiness for non-technical people. A beginner can navigate through a
site with ease if its simple and well informative.
 Usage of blocks and typography makes user experience better.
 Easy setup and ready to start working are awesome. Hiding the complexity
of actions from the user and display only the required information is key to
good interface.

Disadvantages of UI Design

Some disadvantages of UI design are listed below:


 When not properly built, it can be very difficult to work with.
 Takes time to build a Perfect UI Design.
 May lack customization options, preventing users from adapting the
interface to their preferences or workflow.

Difference between UI Design and UX Design

Though User Interface (UI) and User Experience (UX) are closely related
concepts in the field of software and website development, they differ in the
aspects of the overall user interaction with a product.

User Interface(UI) User Experience(UX)

UI focuses on the quality of the UX centres around the intent and


user’s contact with the product functionality of the product.

UI comprises more creative design UX involves components like market


elements linked to the look and feel research and understanding consumer
of the user’s experience needs.

UX are concerned with managing the


UI is more particularly focused on
overall project from ideation through
the design of the end product
development and delivery

9
System Call

A system call is a 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 requests the operating
system’s kernel. System call provides the services of the operating system
to the user programs via the Application Program Interface (API). System
calls are the only entry points into the kernel system and are executed in
kernel mode.

Services Provided by System Calls


 Process Creation and Management
 Main Memory Management
 File Access, Directory, and File System Management
 Device Handling(I/O)
 Protection
 Networking, etc.
o Process Control: end, abort, create, terminate, allocate, and free
memory.
o File Management: create, open, close, delete, read files, etc.
o Device Management
o Information Maintenance
o Communication

10
Features of System Calls

 Interface: System calls provide a well-defined interface between user


programs and the operating system. Programs make requests by calling
specific functions, and the operating system responds by executing the
requested service and returning a result.
 Protection: System calls are used to access privileged operations that are not
available to normal user programs. The operating system uses this privilege
to protect the system from malicious or unauthorized access.
 Kernel Mode: When a system call is made, the program is temporarily
switched from user mode to kernel mode. In kernel mode, the program has
access to all system resources, including hardware, memory, and other
processes.
 Context Switching: A system call requires a context switch, which involves
saving the state of the current process and switching to the kernel mode to
execute the requested service. This can introduce overhead, which can
impact system performance.
 Error Handling: System calls can return error codes to indicate problems
with the requested service. Programs must check for these errors and handle
them appropriately.
 Synchronization: System calls can be used to synchronize access to shared
resources, such as files or network connections. The operating system
provides synchronization mechanisms, such as locks or semaphores, to
ensure that multiple programs can access these resources safely.
How does System Call Work?
Here is a detailed explanation step by step how system calls work:
 Users need special resources: Sometimes programs need to do some special
things that can’t be done without the permission of the OS like reading from
a file, writing to a file, getting any information from the hardware, or
requesting a space in memory.
 The program makes a system call request: There are special predefined
instructions to make a request to the operating system. These instructions are
nothing but just a “system call”. The program uses these system calls in its
code when needed.
 Operating system sees the system call: When the OS sees the system call
then it recognizes that the program needs help at this time so it temporarily
stops the program execution and gives all the control to a special part of itself
called ‘Kernel’. Now ‘Kernel’ solves the need of the program.
 The operating system performs the operations: Now the operating system
performs the operation that is requested by the program. Example: reading
content from a file etc.

11
 Operating system give control back to the program : After performing the
special operation, OS give control back to the program for further execution
of program.

Types of System Calls

Services provided by an OS are typically related to any kind of operation that a


user program can perform like creation, termination, forking, moving,
communication, etc. Similar types of operations are grouped into one single
system call category. System calls are classified into the following categories:

12
Examples of a System Call in Windows and UNIX
System calls for Windows and UNIX come in many different forms. These are
listed in the table below as follows:

Process Windows Unix

CreateProcess() Fork()
Process Control ExitProcess() Exit()
WaitForSingleObject() Wait()

Open()
CreateFile()
Read()
File manipulation ReadFile()
Write()
WriteFile()
Close()

SetConsoleMode() Ioctl()
Device Management ReadConsole() Read()
WriteConsole() Write()

GetCurrentProcessID() Getpid()
Information Maintenance SetTimer() Alarm()
Sleep() Sleep()

CreatePipe() Pipe()
Communication CreateFileMapping() Shmget()
MapViewOfFile() Mmap()

SetFileSecurity() Chmod()
Protection InitializeSecurityDescriptor() Umask()
SetSecurityDescriptorgroup() Chown()

Open(): Accessing a file on a file system is possible with the open() system call.
It gives the file resources it needs and a handle the process can use. A file can
be opened by multiple processes simultaneously or just one process. Everything
is based on the structure and file system.

Read(): Data from a file on the file system is retrieved using it. In general, it
accepts three arguments:
 A description of a file.
 A buffer for read data storage.

13
 How many bytes should be read from the file
Before reading, the file to be read could be identified by its file descriptor
and opened using the open() function.

Wait(): In some systems, a process might need to hold off until another process
has finished running before continuing. When a parent process creates a child
process, the execution of the parent process is halted until the child process is
complete. The parent process is stopped using the wait() system call. The parent
process regains control once the child process has finished running.

Write(): Data from a user buffer is written using it to a device like a file. A
program can produce data in one way by using this system call. generally, there
are three arguments:
 A description of a file.
 A reference to the buffer where data is stored.
 The amount of data that will be written from the buffer in bytes.

Fork(): The fork() system call is used by processes to create copies of
themselves. It is one of the methods used the most frequently in operating
systems to create processes. When a parent process creates a child process, the
parent process’s execution is suspended until the child process is finished. The
parent process regains control once the child process has finished running.

Exit(): A system call called exit() is used to terminate a program. In


environments with multiple threads, this call indicates that the thread execution
is finished. After using the exit() system function, the operating system recovers
the resources used by the process.

Fork System Call in Operating System

In many operating systems, the fork system call is an essential operation. The
fork system call allows the creation of a new process. When a process calls
the fork(), it duplicates itself, resulting in two processes running at the same
time. The new process that is created is called a child process. It is a copy of the
parent process. The fork system call is required for process creation and enables
many important features such as parallel processing, multitasking, and the
creation of complex process hierarchies.
It develops an entirely new process with a distinct execution setting. The
new process has its own address space, and memory, and is a perfect duplicate
of the caller process.

14
Basic Terminologies Used in Fork System Call in Operating System

 Process: In an operating system, a process is an instance of a program that


is currently running. It is a separate entity with its own memory, resources,
CPU, I/O hardware, and files.

 Parent Process: The process that uses the fork system call to start a new
child process is referred to as the parent process. It acts as the parent
process’s beginning point and can go on running after the fork.

 Child Process: The newly generated process as a consequence of the fork
system call is referred to as the child process. It has its own distinct process
ID (PID), and memory, and is a duplicate of the parent process.

 Process ID: A process ID (PID) is a special identification that the operating
system assigns to each process.

 Copy-on-Write: The fork system call makes use of the memory
management strategy known as copy-on-write. Until one of them makes
changes to the shared memory, it enables the parent and child processes to
share the same physical memory. To preserve data integrity, a second copy
is then made.

 Return Value: The fork system call’s return value gives both the parent and
child process information. It assists in handling mistakes during process
formation and determining the execution route.

Process Creation
When the fork system call is used, the operating system completely copies the
parent process to produce a new child process. The memory, open file
descriptors, and other pertinent properties of the parent process are passed down
to the child process. The child process, however, has a unique execution route
and PID.
The copy-on-write method is used by the fork system call to maximize memory
use. At first, the physical memory pages used by the parent and child processes
are the same. To avoid unintentional changes, a separate copy is made whenever
either process alters a shared memory page.
The return value of the fork call can be used by the parent to determine the
execution path of the child process. If it returns 0 then it is executing the child
process, if it returns -1 then there is some error; and if it returns some positive
value, then it is the PID of the child process.

15
Advantages of Fork System Call
 Creating new processes with the fork system call facilitates the running of
several tasks concurrently within an operating system. The system’s
efficiency and multitasking skills are improved by this concurrency.
 Code reuse: The child process inherits an exact duplicate of the parent
process, including every code segment, when the fork system call is used. By
using existing code, this feature encourages code reuse and streamlines the
creation of complicated programmes.
 Memory Optimisation: When using the fork system call, the copy-on-write
method optimises the use of memory. Initial memory overhead is minimised
since parent and child processes share the same physical memory pages.
Only when a process changes a shared memory page, improving memory
efficiency, does copying take place.
 Process isolation is achieved by giving each process started by the fork
system call its own memory area and set of resources. System stability and
security are improved because of this isolation, which prevents
processes from interfering with one another.
16
Disadvantages of Fork System Call

 Memory Overhead: The fork system call has memory overhead even with
the copy-on-write optimisation. The parent process is first copied in its
entirety, including all of its memory, which increases memory use.
 Duplication of Resources: When a process forks, the child
process duplicates all open file descriptors, network connections, and other
resources. This duplication may waste resources and perhaps result in
inefficiencies.
 Communication complexity: The fork system call generates independent
processes that can need to coordinate and communicate with one another. To
enable data transmission across processes, interposes communication
methods, such as pipes or shared memory, must be built, which might add
complexity.
 Impact on System Performance: Forking a process duplicates memory
allocation, resource management, and other system tasks. Performance of the
system may be affected by this, particularly in situations where processes are
often started and stopped.

17
Resource Management in Operating System

Resource Management in Operating System is the process to manage all the


resources efficiently like CPU, memory, input/output devices, and other
hardware resources among the various programs and processes running in the
computer.
Resource management is an important thing because resources of a computer
are limited and multiple processes or users may require access to the same
resources like CPU, memory etc. at the same time. The operating system has to
manage and ensure that all processes get the resources they need to execute,
without any problems like deadlocks.
Here are some Terminologies related to the resource management in OS:
 Resource Allocation: This terms defines the process of assigning the
available resources to processes in the operating system. This can be done
dynamically or statically.
 Resource: Resource can be anything that can be assigned dynamically or
statically in the operating system. Example may include CPU time, memory,
disk space, and network bandwidth etc.
 Resource Management: It refers to how to manage resources efficiently
between different processes.
 Process: Process refers to any program or application that is being executed
in the operating system and has its own memory space, execution state, and
set of system resources.
 Scheduling: It is the process of determining from multiple number of
processes which process should be allocated a particular resource at a given
time.
 Deadlock: When two or more processes are waiting for some resource but
resources are busy somewhere else and resources are also waiting for some
process to complete their execution. In such condition neither resources will
be freed nor process would get it and this situation is called deadlock.
 Semaphore: It is the method or tool which is used to prevent race condition.
Semaphore is an integer variable which is used in mutual exclusive manner
by various concurrent cooperative process in order to achieve
synchronization.
 Mutual Exclusion: It is the technique to prevent multiple number of process
to access the same resources simultaneously.
 Memory Management: Memory management is a method used in the
operating systems to manage operations between main memory and disk
during process execution.

18
Features or characteristics of the Resource management of operating
system:

 Resource scheduling: The OS allocate available resources to the processes.


It decides the sequence of which process will get access to the CPU, memory,
and other resources at any given time.
 Resource Monitoring: The operating system monitors which resources is
used by which process and also take action if any process takes many
resources at the same time causing into deadlock.
 Resource Protection: The OS protects the system from unauthorized or
fake access by the user or any other process.
 Resource Sharing: The operating system permits many processes like
memory and I/O devices to share resources. It guarantees that common
resources are utilized in a fair and productive way.
 Deadlock prevention: The OS prevents deadlock and also ensure that no
process is holding resources indefinitely. For that it uses techniques likes’
resource pre-emption.
 Resource accounting: The operating system always tracks the use of
resources by different processes for allocation and statistical purposes.
 Performance optimization: The OS optimizes resources distribution, the
reason is to increase the system performance. For that many techniques like
load balancing and memory management are followed that ensures efficient
resources distribution.

Diagrammatically representation of the Resource management:

19
Semaphores

What is Semaphores?

A semaphore is a synchronization tool used in concurrent programming to


manage access to shared resources. It is a lock-based mechanism designed to
achieve process synchronization, built on top of basic locking techniques.
Semaphores use a counter to control access, allowing synchronization for
multiple instances of a resource. Processes can attempt to access one instance,
and if it is not available, they can try other instances. Unlike basic locks, which
allow only one process to access one instance of a resource. Semaphores can
handle more complex synchronization scenarios, involving multiple processes
or threads. It help prevent problems like race conditions by controlling when
and how processes access shared data.

The process of using Semaphores provides two operations:


 wait (P): The wait operation decrements the value of the semaphore
 Signal (V): The signal operation increments the value of the semaphore.

When the value of the semaphore is zero, any process that performs a wait
operation will be blocked until another process performs a signal operation.
When a process performs a wait operation on a semaphore, the operation checks
whether the value of the semaphore is >0. If so, it decrements the value of the
semaphore and lets the process continue its execution; otherwise, it blocks the
process on the semaphore. A signal operation on a semaphore activates a process
blocked on the semaphore if any, or increments the value of the semaphore by

1. Due to these semantics, semaphores are also called counting semaphores. The
initial value of a semaphore determines how many processes can get past the
wait operation.
Semaphores are required for process synchronization to make sure that multiple
processes can safely share resources without interfering with each other. They
help control when a process can access a shared resource, preventing issues
like race conditions.

20
Types of Semaphores

Semaphores are of two Types:

 Binary Semaphore: This is also known as a mutex lock, as they are locks
that provide mutual exclusion. It can have only two values – 0 and 1. Its value
is initialized to 1. It is used to implement the solution of critical section
problems with multiple processes and a single resource.

 Counting Semaphore: Counting semaphores can be used to control access
to a given resource consisting of a finite number of instances. The semaphore
is initialized to the number of resources available. Its value can range over
an unrestricted domain.

To learn more refer: Types of Semaphores

Working of Semaphore
A semaphore is a simple yet powerful synchronization tool used to manage
access to shared resources in a system with multiple processes. It works by
maintaining a counter that controls access to a specific resource, ensuring that
no more than the allowed number of processes access the resource at the same
time.
There are two primary operations that a semaphore can perform:
1. Wait (P operation): This operation checks the semaphore’s value. If the
value is greater than 0, the process is allowed to continue, and the
semaphore’s value is decremented by 1. If the value is 0, the process is
blocked (waits) until the semaphore value becomes greater than 0.
2. Signal (V operation): After a process is done using the shared resource, it
performs the signal operation. This increments the semaphore’s value by 1,
potentially unblocking other waiting processes and allowing them to access
the resource.

Protection and Security in Operating System

Protection and security requires that computer resources such


as CPU, software, memory etc. are protected. This extends to the operating
system as well as the data in the system. This can be done by ensuring integrity,
confidentiality and availability in the operating system. The system must be
protect against unauthorized access, viruses, worms etc.

21
Threats to Protection and Security

A threat is a program that is malicious in nature and leads to harmful effects for
the system. Some of the common threats that occur in a system are −

Virus

Viruses are generally small snippets of code embedded in a system. They are very
dangerous and can corrupt files, destroy data, crash systems etc. They can also
spread further by replicating themselves as required.

Trojan horse

A Trojan horse can secretly access the login details of a system. Then a malicious
user can use these to enter the system as a harmless being and wreak havoc.

Trap Door

A trap door is a security breach that may be present in a system without the
knowledge of the users. It can be exploited to harm the data or files in a system
by malicious people.

Worm

A worm can destroy a system by using its resources to extreme levels. It can
generate multiple copies which claim all the resources and don't allow any other
processes to access them. A worm can shut down a whole network in this way.

Denial of Service

These type of attacks do not allow the legitimate users to access a system. It
overwhelms the system with requests so it is overwhelmed and cannot work
properly for other user.

22
Protection and Security Methods

The different methods that may provide protect and security for different
computer systems are −

Authentication

This deals with identifying each user in the system and making sure they are who
they claim to be. The operating system makes sure that all the users are
authenticated before they access the system. The different ways to make sure that
the users are authentic are:

 Username/ Password
Each user has a distinct username and password combination and they need to
enter it correctly before they can access the system.
 User Key/ User Card
The users need to punch a card into the card slot or use they individual key on a
keypad to access the system.
 User Attribute Identification
Different user attribute identifications that can be used are fingerprint, eye retina
etc. These are unique for each user and are compared with the existing samples
in the database. The user can only access the system if there is a match.

One Time Password

These passwords provide a lot of security for authentication purposes. A onetime


password can be generated exclusively for a login every time a user wants to enter
the system. It cannot be used more than once.

Difference between Security and Protection


Last Updated: 23 Jul, 2024

An operating system provides a method to prevent tampering with both logical
and physical resources. Security and protection rank among them as two.
Protection and security are distinct concepts, even though they are frequently
used synonymously. To protect user applications and data, unauthorized users
must be kept out of the system. In contrast, security entails guarding against
interference from outside parties like unauthorized users of other systems and
preventing the user’s programs and data from being used.

23
The operating system’s security and protection are discussed in this article. You
must understand the OS’s security and protection before we can talk about the
differences.

What is Security?
The security systems cover the safety of their system resources (saved data,
memory, disks, etc.) across malignant alteration, illegal access, and disparity or
inconsistency. The security gives a mechanism (authentication and encryption) to
analyse the user to permit for using the system. For example, in a corporation the
info is obtained by completely different workers however, it can’t be obtained by
a user that doesn’t exist in this explicit organization or a user operating in different
business enterprises. Security is a vital task for a corporation to provide some
safety mechanism so that no outside user will access the knowledge of the
organization.

What is Protection?
The protection deals with access to the system resources. It determines what files
can be accessed or permeated by a special user. The protection of the system
should confirm the approval of the process and users. Due to this, these licensed
users and processes will care for the central processing unit, memory, and
alternative sources. The protection mechanism ought to provide a path for
specifying the controls to be obligatory, besides how to implement them. An
example of protection can be given by security, any organization will have many
departments below which several staffs operate. The assorted departments will
share frequent info with one another but not sensitive info. So, completely
different employees have different access rights to the info in step with that they
will access the defined data.

Differences between the Security and Protection in Operating Systems


Between security and protection in the OS, there are a number of significant
distinctions. The following are some significant distinctions between security and
protection:
1. Operating systems use security as a technique to deal with external threats and
maintain the system’s proper operation. Protection, on the other hand, is a
method used in operating systems to manage risks and keep the system
operating correctly.
2. The security measure establishes whether a particular user is permitted access
to the system or not. The protection method, on the other hand, specifies which
users are allowed access to a specific resource.
3. A few security measures are adding and deleting users, checking a user’s
authorization, using anti-malware software, etc.

24
Let’s see the difference between security and protection:

Security Protection

Security grants the system access to the While protection deals with access to
appropriate users only. the system resources.

While in protection, internal threats


In security, external threats are involved.
are involved.

In security, more convoluted queries are Whereas in protection, simple


handled. queries are handled.

Whereas protection determines what


Security illustrates that which person is
files can be accessed or permeated
granted for using the system.
by a special user.

Whereas in protection, an
In security, encryption and certification
authorization mechanism is
(authentication) mechanisms are used.
implemented.

Difference between MultiCore and MultiProcessor System


In today’s tech world, multi-core and multi-processor systems have become
essential for boosting computing power and efficiency. A multicore system packs
several processing units or cores into a single chip allowing it to tackle multiple
tasks at once. Multiprocessor system uses two or more separate processors that
share resources enabling them to work together seamlessly. This means that if
one processor runs into trouble the others can keep things running smoothly. Both
systems are designed to meet the increasing demands of modern applications with
multicore systems focusing on maximizing performance within a single chip and
multiprocessor systems expanding capabilities through multiple CPUs.

25
What is a Multicore System?

A processor that has more than one core is called a Multicore Processor while one
with a single core is called Unicode Processor or Uniprocessor. Nowadays, most
systems have four cores (Quad-core) or eight cores (Octal-core). These cores can
individually read and execute program instructions, giving feel like a computer
system has several processors but in reality, they are cores and not processors.
Instructions can be calculation, data transferring instruction, branch instruction,
etc. Processors can run instructions on separate cores at the same time. This
increases the overall speed of program execution in the system. Thus heat
generated by the processor gets reduced and increases the overall speed of
execution.
Multicore systems support Multithreading and Parallel Computing. Multicore
processors are widely used across many application domains, including general-
purpose, embedded, network, digital signal processing (DSP), and graphics
(GPU). Efficient software algorithms should be used for the implementation of
cores to achieve higher performance. Software that can run parallel is preferred
because we want to achieve parallel execution with the help of multiple cores.

Advantages of Multicore System


 These cores are usually integrated into single IC (integrated circuit) die, or
onto multiple dies but in single chip package. Thus allowing higher Cache
Coherency.
 These systems are energy efficient since they allow higher performance at
lower energy. A challenge in this, however, is additional overhead of writing
parallel code.
 It will have less traffic (cores integrated into single chip and will require less
time).

Disadvantages of Multicore System

 Dual-core processor do not work at twice speed of single processor. They get
only 60-80% more speed.
 Some Operating systems are still using single core processor.
 OS compiled for multi-core processor will run slightly slower on single-core
processor.

What is MultiProcessor System?

Two or more processors or CPUs present in same computer, sharing system bus,
memory and I/O is called MultiProcessing System. It allows parallel execution of
different processors. These systems are reliable since failure of any single
processor does not affect other processors. A quad-processor system can execute

26
four processes at a time while an octa-processor can execute eight processes at a
time. The memory and other resources may be shared or distributed among
processes.

Advantages of Multiprocessor System


 Since more than one processor are working at the same time, throughput will
get increased.
 More reliable since failure in one CPU does not affect other.
 It needs little complex configuration.
 Parallel processing (more than one process executing at same time) is
achieved through MultiProcessing.

Disadvantages of MultiProcessor System

 It will have more traffic (distances between two will require longer time).
 Throughput may get reduced in shared resources system where one processor
using some I/O then another processor has to wait for its turn.
 As more than processors are working at particular instant of time. So,
coordination between these is very complex.

Difference between MultiCore and MultiProcessor System

MultiCore MultiProcessor

A single CPU or processor with two or


A system with two or more CPU’s
more independent processing units
that allows simultaneous processing
called cores that are capable of reading
of programs.
and executing program instructions.

It executes single program faster. It executes multiple programs Faster.

More reliable since failure in one


Not as reliable as multiprocessor.
CPU will not affect other.

It has less traffic. It has more traffic.

27
MultiCore MultiProcessor

It does not need to be configured. It needs little complex configuration.

It is Expensive (Multiple separate


It’s very cheaper (single CPU that does
CPU’s that require system that
not require multiple CPU support
supports multiple processors) as
system).
compared to MultiCore.

28

You might also like