MCS-41 Solved Assignments
MCS-41 Solved Assignments
in
https://www.facebook.com/IGNOUHelp.in
This assignment has four questions. Answer all questions. Each question is of 20
marks. Rest 20
marks are for viva voce. You may use illustrations and diagrams to enhance
the explanations.
Please go through the guidelines regarding assignments given in the Programme
Guide.
Question 1:
Consider the following
jobs: Job #
Arrival
Run
time
time
A
0
4
B
2
5
C
3
2
D
5
4
a) Using the SJF method, compute the completion times of the above jobs, average
turn
around time and average waiting time.
b) Using the SRTF (Shortest Remaining Time first) method, compute the completion
times
of the above jobs, the average turn around time and the average waiting time. Note
that
SRTF is SJF with preemption. (Hint: Completion time - arrival time = turnaround
time).
c) Using the Round Robin method (with Quantum = 2), compute the
completion times of the
above jobs and the average waiting time.
Question 2:
a. Explain the Banker’s problem. Consider the following snapshot of a system:
How many page faults would occur for following replacement algorithms assuming one,
two,
three, four, five, six or seven frames? Remember that all frames are initially empty, so your
first
unique pages will all cost one fault each.
i. LRU replacement.
ii. FIFO replacement.
iii. Optimal replacement.
R21 R20 R19 R18 R17 R16 R15 R14 R13 R12 R11 R10 R9 R8 R7 R5 R5 R4 R3 R2 R1
4
3
2
1
2
3
6
7
3
2
1
2
6431
243
21
1
Page out
Page in
When? 2
-----
1,2,3,4,5
R1 => R7
3
1
6
R8
4
2
1
R10
5
3
2
R11
6
4
3
R12
1
5
7
R13
2
Swapped in page
# of page faults using FIFO =5 (without replacement) + 5 (with replacement)=10
b) Memory with 5 frames + LRU method:
Why?
2
Page
out
Page in
When?
(Notes)
36
-----
1,2,3,4,5
R1 => R7
There is free
4
3
frames
5
7
3
6
R8
5,1,2,4,3
4
3
R12
2,1,6,5,4
Swapped out page
57
R13
3,2,1,6,5
Swapped in page
1
Why?
2
Page out
Page in
When?
(Notes) 3
-----
1,2,3,4,5
R1 => R7
There is free
4
6
frames
5
7
4
6
R8
2,1,3, 4 or 5
5
7
R13
6,3,2,1 ,5
Swapped out page
Swapped in page
# Frames LRU
FIFO
Optimal
1 20 20
20 2
18
18
15
3
15
16
11
4
10
14
8
5
8
10
7
6
7
10
7
7
7
7
7
Under what circumstances do page faults occur? Describe the actions taken by
the operating
system when a page fault occurs.
Q.3(a) The Linux kernel does not allow paging out of kernel memory. What
effect does this
restriction have on the kernel’s design? What are two advantages and
two disadvantages of this
design decision?
Answer: The primary impact of disallowing paging of kernel memory in Linux is that the
non-preemptability of the kernel is preserved. Any process taking a page fault, whether in kernel
or in
user mode, risks being rescheduled while the required data is paged in from disk. Because
the kernel
can rely on not being rescheduled during access to its primary data structures, locking
requirements
to protect the integrity of those data structures are very greatly simplified. Although design
simplicity is a benefit in itself, it also provides an important performance advantage on
uniprocessor
machines due to the fact that it is not necessary to do additional locking on most internal
data structures.
There are a number of disadvantages to the lack of pageable kernel memory, however.
First of all, it
imposes constraints on the amount of memory that the kernel can use. It is unreasonable to
keep
very large data structures in non-pageable memory, since that represents physical memory
that
absolutely cannot be used for anything else. This has two impacts: first of all, the
kernel must prune
back many of its internal data structures manually, instead of being able to rely on a single
virtualmemory mechanism to keep physical memory usage under control. Second, it makes
it
infeasible to implement certain features that require large amounts of virtual memory in the
kernel,
such as the /tmp-74 Chapter 21 The Linux System filesystem (a fast virtual-memory-based
file
system found on some UNIX systems).
Note that the complexity of managing page faults while running kernel code is not an
issue here. The
Linux kernel code is already able to deal with page faults: it needs to be able to deal with
system
calls whose arguments reference user memory that may be paged out to disk.
File Management
I/O System Management
Secondary Management
Networking
Protection System
Command-Interpreter System
PROCESS MANAGEMENT
A process is a program in execution: (A program is passive, a process active.)
A process has resources (CPU time, files) and attributes that must be
managed. Management of processes includes:
· Process Scheduling (priority, time management, . . . )
· Creation/termination
· Block/Unblock (suspension/resumption )
· Synchronization
· Communication
· Deadlock handling
· Debugging
MAIN MEMORY MANAGEMENT
· Allocation/de-allocation for processes, files, I/O.
· Maintenance of several processes at a time
· Keep track of who's using what memory
· Movement of process memory to/from secondary storage.
FILE MANAGEMENT
A file is a collection of related information defined by its creator. Commonly, files
represent
programs (both source and object forms) and data. The operating system is responsible for
the
following activities in connections with filemanagement:
Total virtual physical memory = Physical Memory (RAM) + a small portion on hard disk
which is
treated similar to physical memory (page file).
Few
terminology
about
Processes
table:
1.
Commit: Amount of virtual memory reserved by the operating system for the
process. This includes both amount of physical memory (RAM) being used and any page
that
is saved in page file
(HDD). 2.
Working Set: Amount of physical memory currently in use by the process. This
memory component is consiste of 2 parts: Shareable & Private.
1.
Shareable: Amount of physical memory in use by the process that can be
shared with other processes. By sharing memory we mean sharing those files, in fact dll,
which are required by multiple processes so that instead of loading them multiple times
for different processes , load one copy of the file in physical memory and map it to
the virtual address space of other processes that need access. Thus sharing memory
saves memory space as only one copy of the page/file is loaded.
2.
Private: Amount of physical memory in use by the process that cannot be
used by other processes. This number provides a pretty accurate measure of the
amount of memory that a particular application need in order to run.
3.
Hard Faults/ sec ( not visible in above figure because might be not in use currently on
my system): The Hard Faults/sec column shows the average number of hard page faults
per
second that have occurred in the last minute. If a process attempts to use more physical
memory than is currently available, the system must write, or page, some of the memory
contents (RAM) to disk (in the form of page file on Hard drive). If the process later needs
and
accesses the memory contents that exist on the disk, it is called a Hard Fault i.e. this
terms denotes how much hard disk page file contents are being used/fetched.
Windows
7
memory
management:
When you open and work with applications, the operating system’s memory
manager monitors the
Working Set of each process and watches for requests for additional memory resources. As
the
Working Set of a process grows, the memory manager balances the process’ demand for
more
memory against requests from the kernel and other processes. If available address
space becomes
scarce, the memory manager must scale back the size of the working set. This typically
means
paging some of the memory contents to disk. Thus a portion of memory content of RAM is
moved to
hard
disk
in
the
form
of
page
file.
If an application requires the content of that page file (stored in HDD), it will read back
and causes a
Hard Fault. While Hard Faults are a pretty normal occurrence, multiple Hard
Faults typically require
additional time so that the system can read pages from the disk. When Hard Faults occur
too
frequently, the resulting disk reads will decrease system responsiveness. If you have
ever been
working on your system and suddenly everything seems to run in slow motion and
then just
as suddenly comes back to regular speed, chances are good that your system is busily
swapping memory around so that it can continue working. As such, if you notice an
excessive
number of Hard Faults related to a particular process on a regular basis, chances are
your system needs
more
physical
memory.
Visualizing
your
physical
memory
distribution:
In order to visualize the memory usage of physical memory, you can use physical memory
table in
Resource
Monitor
which is
actually
a
bar
graph
showing
memory
distribution.
*My system memory distribution with visual studio running and few chrome tabs open
As you use your system, the memory manager is at work in the background
moving memory back
and forth between these lists in order to maintain a delicate balance between using
physical memory
and the hard disk in order to allow your system to work efficiently and effectively.
Following
are
the
5
major
categories
where
physical
memory
is
distributed:
1.
Hardware
Reserved
2.
In
Use
3.
Modified
4.
StandBy
5. Free
Windows 7 the newest operating system from Microsoft, simplifies computer security,
making it easier for you to reduce the risk of damage caused by viruses, spyware and other
malware. Windows 7 also features an improved backup solution to help keep your information
safe, and its improved parental controls help you protect your
family.
Read about the new and improved safety, security, and privacy features in Windows 7.
The Action Center: security information at your fingertips
The new Windows 7 Action Center in the Control Panel helps you make sure that your
firewal is on, your antivirus software is up to date, and your computer is set to instal updates
automatical y. For more information, see How
does Action Center check for problems?
Windows Firewal can also help protect your computer from hackers and malicious
software. With Windows 7, the built-in firewal is more flexible and easier to use than before.
The Microsoft backup system is also improved for Windows 7. Backup and Restore
creates copies of your most important files, so you're always prepared for the worst. For more
information, see Backup and restore: frequently
asked questions.
Defend your computer against viruses, spyware, and
other malware
Microsoft Security Essentials is a free download for Windows 7 that helps protect your
computer from viruses, spyware, worms, Trojans, and other malware. For more information,
see Help Protect your PC with Microsoft
Security Essentials.
Windows 7 also includes Windows Defender, software that helps protect your computer
from pop-up ads, slow performance, and security threats caused by spyware and other
unwanted software. For more information,
see Using Windows Defender.
Reduce risk by enhancing security and control
Windows 7 makes it easier and less intrusive to run your computer as a standard
user instead of as an
administrator. Windows Vista introduced User Account Control, a feature that warned
you when a program wanted to make a change on your computer. Windows 7 improves on this
feature, which means you’l get the
same level of protection, but with fewer messages than before.
developers to use better coding practices and not expect access to sensitive areas of
the operating system, most people have perceived UAC as a security feature.
When users think of UAC, they typically associate it with the access-consent prompts it
issues.
Though Microsoft has made significant progress since Vista's introduction in reducing the
types
and number of events that trigger the UAC prompt (or that prevent standard users from
executing
tasks entirely), UAC has still been the subject of a great deal of negative feedback for
Vista.
Windows 7 allows you to configure the level of UAC protection.With
Windows 7, Microsoft has again reduced the number of applications and operating system
tasks
that trigger the prompt. It has also incorporated a more flexible interface for UAC. Under
User
Accounts in the Control Panel, you can select Change User Account Control Settings
to adjust the feature with a slider.
The configuration slider lets you choose from among four levels of UAC protection,
ranging from
Always Notify (essentially the level of UAC protection that Windows Vista provides) to
Never
Notify. Obviously, you'll get the most protection with Always Notify. The advantage
to setting the
slider to Never Notify as opposed to disabling UAC completely is that the prompt is only
one
aspect of what UAC does. Under the Never Notify setting, though UAC pop-ups will no
longer
interrupt you, some of UAC's core protections will remain, including Protected
Mode Internet
Explorer.
Integrated Fingerprint Scanner Support
Many Windows users configure the operating system to log them in without a user name
and
password--but that's the computer equivalent of leaving the front door of your house wide
open
with a neon sign flashing "Enter Here." I highly recommend that you assign all
user accounts in
Windows 7 a relatively strong password or passphrase (that means your dog's name or
your favorite basketball team don't count).
Even passwords aren't all they're cracked up to be. Passwords are secure only until they're
cracked, and cracking a password is more a matter of when than if, assuming an attacker
is sufficiently dedicated. Experts recommend two-factor authentications--in other words,
adding
another layer of protection on top of the password--for better security. Many computers,
laptops
in particular, come equipped with built-in biometric security in the form of a fingerprint
scanner.
With Windows 7, Microsoft provides much smoother integration between the operating
system
and the fingerprint-scanning hardware.
-----------------------------------------------------THE
END----------------------------------------------------------------
https://www.facebook.com/IGNOUHelp.in