Gla University (Mathura) Bca 2nd Semester Operating System PDF
Gla University (Mathura) Bca 2nd Semester Operating System PDF
Process management
• A program in its execution state is known as process.
• A process needs certain resources including CPU time, memory, files and
I/O devices to accomplish its task.
• These resources are either given to the process when it is created or
allocated to it while it is running.
• A program is a passive entity such as contents of a file stored on the disk
whereas a process is an active entity
The operating system is responsible for the following activities in
process management:
• Creating and deleting both user and system processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling.
2. Memory management
Main memory is a collection of quickly accessible data shared by the CPU and I/O
devices.
The central processor reads instructions from main memory (during instruction-
fetch cycle) and both reads and writes data from main memory (during data-
fetch cycle).
The operating system is responsible for the following activities in memory
management:
• Keeping track of which parts of memory are currently being used and by whom
• Deciding which processes and data to move into and out of memory
• Allocating and deallocating memory space as needed.
3. File-System Management
The operating system is responsible for the following activities with file management:
• Creating and deleting files
• Creating and deleting directories to organize files
• Supporting primitives for manipulating files and directories
• Backing up files on stable (nonvolatile) storage media.
4. Secondary storage ManagementThe operating system is responsible for the
following activities with disk management:
• Free-space management
• Storage allocation
• Disk scheduling
5. I/O system Management
The operating system is responsible for the following activities with I/O subsystem:
• A memory-management component that includes buffering, caching, and spooling
• A general device-driver interface
• Drivers for specific hardware devices
8.Command Interpreter
• To interface with the operating System we use command-line interface or command interpreter
that allows users to directly enter commands that are to be performed by the operating system.
• The main function of the command interpreter is to get and execute the user-specified
commands. Many of the commands given at this level manipulate files: create, delete, list, print,
copy, execute, and so on. Eg: MS-DOS and UNIX shells.
Course Name: Introduction of Logic Circuit & Digital Design
Course Code: BCAC0003
• In a typical sequence first the editor is been called to create a source code of user
program then translator is been called to convert source code into its object code,
finally the loader is been called to load its executable program into main memory for
execution.
• If syntax errors are detected than the whole program must be restarted from the
beginning.
Batch processing Operating System
Job 3
• Advantages:
• Efficient memory utilization
Job 4
• Throughput increases
Job 5
• CPU is never idle, so performance
increases.
Multiprocessor system :-This system has more than one processor which
share common bus, clock, peripheral devices and sometimes memory.
These systems have following advantages:
• Increased throughput By increasing the number of processor, we get more
work done in less time.
• Economy of scale Multiprocessor system are cost effective as several
processors share same resources of the system(memory, peripherals etc.)
• Increased reliability each processor is been fairly allotted with different job,
failure of one processor will not halt the system, only it will slower down
the performance. for example if we have ten processor and one fails, then
each of the remaining nine processor share the work of failed processor.
Thus the system will be 10% slower rather than failing altogether
This system can be categorized into:
4)File-system manipulation:- Programs need to read and write files. They also need to
create and delete. Finally, some programs include permissions management to allow or
deny access to files or directories based on file ownership.
5) Input / Output Operations:-A program which is currently executing
may require I/O, which may involve file or other I/O device. For
efficiency and protection, users cannot directly govern the I/O devices.
So, the OS provide a means to do I/O Input / Output operation which
means read or write operation with any file
6) Communications. There are many circumstances in which one process needs to
exchange information with another process.
Such communication may occur between processes that are executing on the
same computer or between processes that are executing on different computer
systems tied together by a computer network.
7) Error detection. Errors may occur in the CPU and memory hardware (such as a
memory error or a power failure), in I/O devices (a network failure, or lack of
paper in the printer), and in the user program (such as an arithmetic overflow, an
attempt to access an illegal memory location, or too-great use of CPU time).
For each type of error, the operating system should take the appropriate action
to ensure correct and consistent computing.
8. Resource allocation. When there are multiple users or multiple jobs running at the same
time, resources must be allocated to each of them. Many different types of resources are
managed by the operating system trough various methods such as CPU-scheduling.
9. Accounting. OS keeps track of which users use how much and what kind of computer
resources. This record keeping may be used for accounting
10. Protection and security. When several separate processes execute concurrently, it should
not be possible for one process to interfere with the others or with the operating system
itself.
Protection involves ensuring that all access to system resources is controlled. Security of the
system from outsiders is also important by means of a password, to gain access to system
resources.
Course Name: Introduction of Logic Circuit & Digital Design
Course Code: BCAC0003
• A real time system has well defined fixed time constraints, processing
must be done within defined constraints or system will get failed.
• System that controls scientific system, experimenting medical system,
industrial control system and certain display systems are real time
system.
• They are also applicable to automobile engine fuel system, home
appliance controller and weapon systems.
• There are two types of real system:
• i) Hard real time system This system guarantees that critical tasks be
completed on time. For this all the delays in the system should be
bounded, from the retrieval of stored data to the time it takes operating
system to finish any request made to it.
• ii) Soft real time system This is less restrictive type of system defined as
not hard real-time, simply providing that a critical real-time task will
receive priority over other tasks and that it will retain the priority until it
completes.
Netwok Operating System :-An Os that includes special functions for
connecting computers and devices into a LAN. Some OS such as UNIX and
the Mac OS, having networking functions built in.
Some popular NOS’s for DOS and Windows systems include Novell
Netware, Microsoft LAN Manager and Windows NT.
• Some characteristics
• Each computer has its own private OS, instead of running part of a global
system wide operating system.
• Each user normally works on his/her own system.
Distributed Operating System :-It hides the existence of multiple
computers from the user i.e. the user doesn’t know that many
computers are being used to process the data.
These computers may be located at many places around the globe. This
OS provides provide single-system image to its users. All these
computers work in close coordination with each other.
• In this OS, each processor has its own memory and clock. The processor
communicates with each other through various communication lines
such as high speed buses and telephone lines.
Course Name: Introduction of Logic Circuit & Digital Design
Course Code: BCAC0003
• 1) The Kernel It’s the core of the system. It controls all the tasks,
schedules all the processes and carries out all the crucial features of the
operating system.
• It manages the files, carries out all the data transfer between the file
system and the hardware, and also manages memory.
• Among major duties of the Kernel is to keep track of the programs that
are executing, allot processor time to each and also decide when one
program stops and another starts.
• The Kernel also handles information exchange between the computer and
its terminals, tapes drives and printers.
2) The Shell
• It is the Command Interpreter of the operating system. It accepts
commands from the user and analyses and interprets these commands
and finally starts executing their appropriate executable file.
• It then requests the Kernel to carry out the actual transfer of data which
finally leads to the output that is displayed on the terminal.
• Hence the Shell act as an Middleman between the Kernel and the User of
the Operating System.
• There are three shells mainly used in UNIX.
• i) The Bourne Shell
• This is one of the most widely used shells in the Unix world. It was
developed by Steve Bourne of AT&T Bell Labs in the late 1970’s. It is the
primary Unix Command Interpreter and comes along with every Unix
System. The $ prompt is the trademark of Bourne Shell.
• ii) The C Shell
• It was created by Bill Joy at University of California, Berkeley. It has 2
advantages over the Bourne Shell:
• Aliasing. The C shell permits you to call frequently used commands by
your own formulated abbreviations. This proves very useful when
lengthy commands which are used time and again are renamed by you.
Instead of typing the entire command you can simply use the short alias
at the command line.
• A history mechanism. Previously typed command can be recalled, since
the C Shell keeps track of all the command issued at the command line.
This feature is similar to the one provided by the program DOSKEY in
MS-DOS.
• iii) The Korn Shell
• Developed by David Korn of AT&T, this shell was designed to be
much bigger than the Bourne Shell and includes several
features that make it more superior.
• It is more powerful, versatile and efficient than Bourne Shell.
• The Korn Shell includes all the enhancements in the C shell, like
command history and aliasing, and offers a more few features
itself.
• 3) Tools and Application The outermost layer of the operating
system is its tools and applications.
• As some versions of Unix are decked with more than 400 tools
and applications.
• These tools can be invoked from the command line itself and
help to perform day-to-day complex tasks of the system.
• These are placed one level above the Shell and can be
extended as per user convenience.
Course Name: Introduction of Logic Circuit & Digital Design
Course Code: BCAC0003
From lecture-9.ppt
Characteristics of Memory Hierarchy
• The memory hierarchy characteristics mainly include the following.
• Performance
• The speed gap among the main memory as well as the CPU registers enhances
because of the huge disparity in access time, which will cause the lower
performance of the system.
• So, the enhancement was mandatory. The enhancement of this was designed in
the memory hierarchy model due to the system’s performance increase.
• Ability
• The ability of the memory hierarchy is the total amount of data the memory can
store. Because whenever we shift from top to bottom inside the memory hierarchy,
then the capacity will increase.
• Access Time
• The access time in the memory hierarchy is the interval of the time
among the data availability as well as request to read or write. Because
whenever we shift from top to bottom inside the memory hierarchy,
then the access time will increase
• Cost per bit
• When we shift from bottom to top inside the memory hierarchy, then
the cost for each bit will increase which means an internal Memory is
expensive compared with external memory
Course Name: Introduction of Logic Circuit & Digital Design
Course Code: BCAC0003
4
Fixed Partitioning – Problems
• Main memory use is inefficient. Any program, no matter how
small, occupies an entire partition. This is called internal
fragmentation.
• Unequal-size partitions lessens these problems but they still
remain...
• Equal-size partitions was used in early IBM’s OS/MFT
(Multiprogramming with a Fixed number of Tasks)
5
Multiple Partition Allocation: Dynamic
• Hole – block of available memory; holes of various size are scattered throughout
memory.
• When a process arrives, it is allocated contiguous memory from a hole large enough
to accommodate it.
• Operating system maintains information about:
a) allocated partitions b) free partitions (hole)
OS OS OS OS
process 8 process 10
• First-fit and best-fit better than worst-fit in terms of speed and storage
utilization.
Fragmentation
• Internal Fragmentation – allocated memory may be
slightly larger than requested memory; this size
difference is memory internal to a partition, but not
being used.
– Occurs when memory is allocated in fixed size pieces
External Fragmentation
• Total memory space exists to satisfy a request, but it is
not contiguous. (Stats indicate 1/3 wastage)
• If the size of logical address space is 2m and a page size is 2n addressing units (bytes
or words), then the high-order m – n bits of a logical address designate the page
number, and the n low-order bits designate the page offset. Thus, the logical address
is as follows:
• where p is an index into the page table and d is the displacement within the page.
Here, in the logical address, n= 2 and m = 4. Using a page size
of 4 bytes and a physical memory of 32 bytes (8 pages), we show how the
user's view of memory can be mapped into physical memory.
•Indexing into the page table, we find that page 0 is in frame 5. Thus, logical
address 0 maps to physical address 20 [= (5 x 4) + 0]
2) Assume a page size of 1K and a 15-bit logical address space. How many pages are in the
system?
2^5 = 32.
3) Assuming a 15-bit address space with 8 logical pages. How large are the pages?
2^12 = 4K(4096).
Consider logical address 1025 and the following page table for some
process P0. Assume a 15-bit address space with a page size of 1K.
What is the physical address to which logical address 1025 will be
mapped?
8
0
2
Consider logical address 1025 and the following page table for some
process P0. Assume a 15-bit address space with a page size of 1K. What
is the physical address to which logical address 1025 maps?
0 000010000000001
2
Consider logical address 1025 and the following page table for
some process P0. Assume a 15-bit address space with a page
size of 1K. What is the physical address to which logical address
1025 maps?
The next step would be a four-level paging scheme, where the second-level
outer page table itself is also paged, and so forth.