You are on page 1of 9

OS (551)

Rida Jamil
1. INTRODUCTION:
OPERTING SYSTEMS:
Operating systems are essential for the functioning of our computers, mobile
phones and, in short, the devices and computer infrastructures that we use in our
daily lives and allow modern societies to run smoothly. They are basic for the
operation of both the hardware and software on our devices.

Different operating systems:

1. Android
2. Windows
3. iOS
4. MacOS
5. Chrome OS
6. Linux

Threads:
A thread is a “subprocess” created inside a process. A process can contain multiple
threads managed by a kernel like the independent processes. The threads existing
inside a process share the resources, such as the address space, code and context
(i.e. variables, etc.).
The thread has a program counter that keeps track of which instruction to execute
next. It has registers, which hold its current working variables. It has a stack, which
contains the execution history.

S.N. PROCESS THREAD


1. Process is heavy weight or resource Thread is light weight taking lesser
intensive. resources than a process.
2. Process switching needs interaction Thread switching does not need to
with operating system. interact with operating system.
3. In multiple processing All threads can share same set of
environments each process open files, child processes.
executes the same code but has its
own memory and file resources.
4. If one process is blocked, then no While one thread is blocked and
other process can execute until the waiting, second thread in the same
first process is unblocked. task can run.
5. Multiple processes without using Multiple threaded processes use
threads use more resources. fewer resources.
6. In multiple processes each process One thread can read, write or
operates independently of the change another thread's data.
others.

S.N. USER-LEVEL THREADS KERNEL-LEVEL THREAD


User-level threads are faster to Kernel-level threads are slower to
1 create and manage. create and manage.

Implementation is by a thread library Operating system supports creation


2 at the user level. of Kernel threads.

User-level thread is generic and can Kernel-level thread is specific to the


3 run on any operating system. operating system.

Thread switching does not require Transfer of control from one thread
Kernel mode privileges. to another within the same process
4
requires a mode switch to the
Kernel.

Multi-threading:
Multithreading is a technique in which a process which is executing an application,
is divided into threads that can run concurrently. Multithreading refers to the
ability of an OS to support multiple, concurrent paths of execution within a single
process.

Multi-threading Models:
Some operating systems provide a combined user level thread and
Kernel level thread facility. Solaris is a good example of this combined approach.
The user threads must be mapped to kernel threads, by one of the following
strategies:

• Many to One Model


• One to One Model
• Many to Many Model
➢ Many to One Model:
In the many to one model, many user-level threads
are all mapped onto a single kernel thread. And the
thread management is handled by the thread library
in user space, which is efficient in nature.

➢ One to One Model:


There is one-to-one relationship of user-level thread
to the kernel-level thread. This model provides more
concurrency than the many-to-one model.

➢ Many to Many:
The many-to-many model multiplexes any number of
user threads onto an equal or smaller number of
kernel threads. In this model, developers can create
as many user threads as necessary and the
corresponding Kernel threads can run in parallel on a
multiprocessor machine. This model provides
the best accuracy on concurrency and when a
thread performs a blocking system call, the
kernel can schedule another thread for
execution.

Benefits:
1. Responsiveness
2. Resource sharing, hence allowing better utilization of resources.
3. Economy i.e. creating and managing threads becomes easier.
4. Scalability i.e. inn Multithreaded processes, threads can be distributed over
a series of processors to scale.
5. Context Switching is faster. Context switching refers to the procedure
followed by CPU to change from one task to another.
2. Definitions
1. Interprocess Communication:
Inter process communication (IPC) is a mechanism which allows
processes to communicate each other and synchronize their
actions. Processes can communicate with each other using these two ways:
Shared Memory
Message passing

 Shared Memory: Shared memory is a memory shared between two or


more processes. Processes can use shared memory for extracting
information as a record from other process as well as for delivering any
specific information to other process.
 Message Passing: In this method, processes communicate with each
other without using any kind of shared memory. If two processes p1 and
p2 want to communicate with each other, they Establish a
communication link and exchange messaged in the form a pair of
primitives.
A process sends
information in the form of
a message to another
process designated by a
destination. A process
receives information by
executing the receive
primitive, indicating the
source and the message.

send (destination, message)


receive (source, message)
2.Distributed System:
When various autonomous interconnected computers communicate
each other using a shared communication network possessing their own
memory unit and CPU then is referred as distributed systems.
3. Spooling:
It is a kind of buffering mechanism or a process in which data is
temporarily held to be used and executed by a device, program or the
system. Data is sent to and stored in memory or any other storage until the
program or computer requests it for execution.
4. Deadlock VS Starvation:

5. Race Condition:
A condition where several processes try to access the resources and
modify the shared data concurrently (at the same time) and outcome of the
process depends on the particular order of execution that leads to data
inconsistency, this condition is called Race Condition. This condition can be
avoided using the technique called Process Synchronization.

6. Process Synchronization:
It is a condition to avoid race condition, in which we allow only one
process to enter and manipulate the shared data in Critical Section. Process
Synchronization is mainly used for Cooperating Process that shares the
resources.
7.Critical Section:
Critical section is a code segment that can be accessed by only one
process at a time. It is the part in which only one process can enter and
modify the shared variable. This part of the process ensures that no other
process can access the resource of shared data.
8. Semaphore:
A Semaphore is an integer variable, which can be accessed only
through two operations wait() and signal(). This variable is used to solve the
critical section problem and to achieve process synchronization in the
multiprocessing environment.

9.Fixed Sized Partitioning (Static Partitioning):


This is the oldest and simplest technique used to put more than one
processes in the main memory. In this partitioning, number of partitions in
RAM are fixed but size of each partition may or may not be same.
Main Advantage: Easy to implement
Main Disadvantage: Internal and External fragmentation
10. Variable Sized Partitioning (Dynamic Partitioning):
It is a part of Contiguous allocation technique in which initially RAM is
empty, and partitions are made during the run-time according to process’s
need. The number of partitions in RAM is not fixed and the size of partition
will be equal to incoming process.
Main advantage: No External fragmentation
Main disadvantage: Internal fragmentation, difficult implementation

11. Logical Address:


It is an address basically generated by the CPU while a program is
running.
Logical Address is divided into:
 Page number(p): Number of bits required to represent the pages in
Logical Address Space or Page number
 Page offset(d): Number of bits required to represent particular word in
a page or page size of Logical Address Space or word number of a page
or page offset.

12. Physical Address:


It is and address actually available on primary memory and read by
primary memory.
Physical Address is divided into
 Frame number(f): Number of bits required to represent the frame of
Physical Address Space or Frame number.
 Frame offset(d): Number of bits required to represent particular word
in a frame or frame size of Physical Address Space or word number of a
frame or frame offset.
13. Paging:
Paging is the approach of non-contiguous memory allocation in which secondary
and main memory are divided into some blocks where the blocks are linked by a
pointer which make it a linked list. It can also be said as a fixed size partitioning
scheme as both main and secondary memory will be divided into fixed and same
size of blocks.
 If the equal size of partition is in secondary memory, then it is called
pages.
 If the equal size of partition is in main/primary memory, then it is called
frames.

7. CASE STUDY OF DIFFERENT


OPERATING SYSTEMS

1. WINDOWS:
Microsoft Windows has existed since 1985. Its latest versions, including
Windows 10, are the most popular operating systems for home and
office computers and are also used on some tablets, and the OS is used
on some web and number-crunching server computers as well.
Computers from a wide variety of manufacturers can use Windows.
Efforts to use versions of the Windows OS for smartphones have been
less successful.
Top 5 Windows Editions:
Versions Released Year Best Features
7. Windows 95 1995 32-Bit processor, gaming platform, build-in
network support
8. Windows XP 2001 Security, power management, networking and
performance.
9. Windows 7 2009 Secure, user-friendly, back-up & recovery tools.

10. Windows 2012 Stable, speedy, mobile interface on a desktop


8 OS.
11. Windows 2015 Fast, stable, robust anti-virus
10

2. Apple iOS:
Apple's iOS is one of the most popular smartphone operating systems.
It runs on Apple hardware, including iPhones, iPad tablets and iPod
Touch media players. Salient features of iOS include an emphasis on
security including strong encryption to limit what unauthorized users
can extract from the phone, and a simple, streamlined interface with
minimal hardware buttons.

Top 5 Windows Editions:


Versions Released Year Best Features
1. iPhone 4 2010 Multitasking, iBooks, airprint, facetime,
great processor
2. iPhone 5 2011 iCloud, Wireless syncing and activation
3. iPhone 6 Plus 2014 Apple maps, bigger screen
4. iPhone 8 Plus 2017 Stable, great processor.
5. iPhone X 2017

You might also like