Operating System LAB: Project - 2
Operating System LAB: Project - 2
Operating System LAB: Project - 2
Total Marks:
Obtained Marks:
Operating System
LAB
Project - 2
Windows:-
Definition:-
Windows is a licensed operating system and its source code is inaccessible. It is
designed for business owners, other commercial user and even individuals with no
computer programming knowledge. It is simple and straightforward to use.
The first version of Windows, known as Windows 1.0, revealed in 1985 following
the formation of Microsoft. It was based upon the MS-DOS core. Following that
initial launch, new versions of Windows were quickly rolled out. This included the
first major update in 1987 and Windows 3.0 in the same year.
In 1995, perhaps the most widely used version yet, Windows 95 was born. At this
point, it ran on a 16-bit DOS-based kernel and 32-bit users-space to enhance the
user experience.
Linux:-
Definition: -
Linux is a free and open-source operating system based on Unix standards which
provides a programming interface as well as user interface compatibility. It also
contains many separately developed elements, free from proprietary code.
Linux was created by Finnish student Linus Torvalds, who wanted to create a free
operating system kernel that anyone could use. It was launched much later than
Windows, in 1991. Although it still was regarded as a very bare bones operating
system, without a graphical interface like Windows. With just a few lines of source
code in its original release to where it stands today, containing more than 23.3
million lines of the source code, Linux has surely grown considerably.
i. Socket
ii. Pipe
iii. Memory---mapped file Suppose you have to transfer several files
and directories from one computer to the other.
i. Which of the above methods would you use if both computers are
running the Linux operating system? Provide justification for
your answer.
Answer:-
The socket is a mechanism that provides a connection between the two-
processor system by using network stacks. In a more clear way, we can use
sockets to communicate and transfer data between two systems.
Following are advantages of socket
Provides flexible access to files and data over a network.
Sharing resources.
Security.
Speed.
Centralized software management.
Provide security like sending sensitive (password protected) files and
programs on a network.
Therefore we use socket in to transfer files and directories.
i. Which of the above methods would you use if both computers are
running the
Windows 10 operating system? Provide justification for your
answer.
Answer:-
We used pipes to transfer files and directories from one computer to other
computer. There are two types of pipes for two-way communication: anonymous
pipes and named pipes. We used Named pipes are used to transfer data between
processes that are not related processes and between processes on different
After we decide that our application would benefit from IPC, you must decide
which of the available IPC methods to use. It is likely that an application will use
several IPC mechanisms. The answers to these questions determine whether an
application can benefit by using one or more IPC mechanisms.
Should the user of the application have to choose the other applications with
which the application communicates, or can the application implicitly find its
cooperating partners?
Should the application communicate with many different applications in a
general way, such as allowing cut-and-paste operations with any other
application, or should its communications requirements be limited to a
restricted set of interactions with specific other applications?
Is performance a critical aspect of the application? All IPC mechanisms
include some amount of overhead.
Should the application be a GUI application or a console application? Some
IPC mechanisms require a GUI application.
Clipboard
COM
Data Copy
DDE
File Mapping
Mail-slots
Pipes
RPC
Windows Sockets
Inter process communication (IPC) is used for exchanging data between multiple
threads in one or more processes or programs. The Processes may be running on
single or multiple computers connected by a network. The full form of IPC is Inter-
process communication.
operating system. This allows a specific program to handle many user requests at
the same time.
message queue,
shared memory
semaphore
pipes
. CPU Scheduling
Suppose that you are listening to an audio file, making a presentation,
and downloading some large files from the Internet. How does the
operating system schedule these processes if you are running?
i. Linux
ii. Windows 10
CPU scheduling:-
Scheduling basically deals with the selection of a process that exists in the memory
and ready to execute. The selected process is allocated with the CPU. This function
is performed by the CPU scheduler. The CPU scheduler makes a sequence of
“moves” that determines the interleaving of threads.
Scheduling In windows:-
All processes receive a priority boost after a wait event, but processes that have
experienced a keyboard I/O wait get a larger boost than those that have experienced
a disk I/O wait.
Scheduling In Linux:-
From versions 2.6 to 2.6.23, the kernel used an O (1) scheduler. The Completely
Fair Scheduler is the name of a task scheduler which was merged into the 2.6.23
release of the Linux kernel. It handles CPU resource allocation for executing
processes, and aims to maximize overall CPU utilization while maximizing
interactive performance. It uses that uses red-black trees instead of queues.
The Round Robin and FIFO scheduling algorithms are used to switch between real-
time processes
Synchronization
Consider a banking system with two functions: deposit (amount) and
withdraw (amount). Both functions are passed the amount that is to be
deposited or withdrawn from a bank account. Assume that a husband
and his wife share the same bank account and concurrently the husband
calls the withdraw() function and the wife calls the deposit () function.
Synchronization in windows:-
Windows operating system is a multithreaded kernel that provide support for real
time application and multiprocessors. On uniprocessor system, Windows provides
interrupt masks to protect access to global resources. It protects access to global
resource using spinlock. The kernel uses spinlocks only to protect short code
segment like Solaris. The kernel ensures that while holding a spinlock, a thread will
never be preempted.
Windows provide dispatcher object for thread synchronization according to several
different mechanisms including mutexes, semaphores, events and timers. The
system protects shared data by requiring a thread to gain ownership of a mutex for
accessing the data and when it is finished, releases the ownership.
Events acts as a conditional variable to notify a waiting thread when desired
condition occurs.
Timers are used to notify one or more thread when time expired.
Dispatcher objects may be either signaled state or a non-signaled state.
Signaled state indicates that an object is available and a thread will not block when
acquiring the object.
Non-signaled state indicates that an object is not available and a thread will block
when trying to acquire the object.
The below figure shows the state transitions of a mutex lock dispatcher object −
Synchronization in linux:-
Process synchronization in Linux involves providing a time slice for each process
so that they get the required time for execution.
The process can be created using the fork() command in Linux. The creating
process is called the parent process and the created process is the child process. A
child process can have only one parent but a parent process may have many
children. Both the parent and child processes have the same memory image, open
files and environment strings. However, they have distinct address spaces.
A diagram that demonstrates the fork() command is given as follows −
. Memory Management
Comparison
1) Data structures
Windows
Linux
Windows
Linux
3) Paging
Linux do not swap the entire process instead uses a lazy swapper.
It never swaps a page into the memory unless that page is needed.
Instead of swapping in a whole process, the pager swaps only necessary
pages into memory.
It thus avoids reading pages that will not be used, this decreases swap time
and amount of physical memory required.
To distinguish between the pages that are in memory and are on the disk we
use valid and non valid bits.
If bit is valid it shows that the page is legal and is in the memory and if bit is
set to invalid it indicates that it is on the disk.
4) Address structure
Linux
Global Directory.
Middle Directory.
Page Table
Offset.
Windows
Page number
Page offset
5) Page replacement
Pages that have been modified are in modified page list. After writing to disk they
are stored in standby list. Pages that have not been modified go to stand by list. The
modified page list is called dirty list and standby list is called clean list.
Active List.
Inactive-dirty List.
Inactive clean List.
Free List.