0% found this document useful (0 votes)
147 views14 pages

CS3451 - Introduction To Operating Systems: Ii Year / Iv Semester

Uploaded by

revicse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views14 pages

CS3451 - Introduction To Operating Systems: Ii Year / Iv Semester

Uploaded by

revicse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

ARASU ENGINEERING

COLLEGE
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CS3451 – INTRODUCTION TO
OPERATING SYSTEMS
II YEAR / IV SEMESTER
Anna University Syllabus, 2021
Regulation
Prepared by
Mrs. V. Revathy
Assistant
Professor/ CSE
Context Switch Time including Swapping
 If next processes to be put on CPU is not in memory, need to swap out a
process and swap in target process
 Context switch time can then be very high
 100MB process swapping to hard disk with transfer rate
of 50MB/sec
 Can reduce if reduce size of memory swapped – by knowing how much
memory really being used

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Context Switch Time and Swapping
 Other constraints as well on swapping
 Pending I/O – can’t swap out as I/O would
occur to wrong process
 Or always transfer I/O to kernel space, then
to I/O device
 Known as double buffering, adds overhead
 Standard swapping not used in modern
operating systems
 But modified version common
 Swap only when free memory extremely low

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Swapping on Mobile Systems
 Not typically supported
 Flash memory based
 Small amount of
space
 Limited number of
write cycles
 Poor throughput between flash memory and CPU on mobile platform
 Instead use other methods to free memory if low
 iOS asks apps to voluntarily
 Read-only data relinquish
thrown allocated
out and memory
reloaded flash if
from needed
 Failure to free can result in termination
 Android terminates apps if low free memory, but first writes
application state to flash for fast restart

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Contiguous Allocation
 Main memory must support both OS and user processes
 Limited resource, must allocate efficiently
 Contiguous allocation is one early method
 Main memory usually into two partitions:
 Resident operating system, usually held in low memory
with interrupt vector
 User processes then held in high memory
 Each process contained in single contiguous section of memory
 Relocation registers used to protect user processes from each other, and
from changing operating-system code and data

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Contiguous Allocation
 Limit register contains range
of logical addresses
– each logical address must
be less than the limit register
 MMU maps logical address
dynamically

Hardware Support for


Relocation and Limit Registers

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Multiple-partition allocation
 Multiple-partition allocation
 Degree of multiprogramming limited by number of partitions
 Variable-partition sizes for efficiency (sized to a given process’ needs)
 Hole – block of available memory; holes of various size are
scattered throughout memory
 When a process arrives, it is allocated memory from a hole large enough
to accommodate it
 Process exiting frees its partition, adjacent free partitions combined
 Operating system maintains information
about:
a) allocated partitions b) free partitions (hole)

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Dynamic Storage-Allocation Problem
 First-fit:Allocate the first hole that is big enough

 Best-fit:Allocate the smallest hole that is big enough; must search


entire list, unless ordered by size
 Produces the smallest leftover hole

 Worst-fit:Allocate the largest hole; must also search entire list


 Produces the largest leftover hole

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Fragmentation
 External Fragmentation – total memory space exists to satisfy a request,
but it is not contiguous
 Internal Fragmentation – allocated memory may be slightly larger than
requested memory; this size difference is memory internal to a partition,
but not being used
 First fit analysis reveals that given N blocks allocated, 0.5N blocks lost to
fragmentation
 1/3 may be unusable -> 50-percent rule

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Fragmentation
 Reduce external fragmentation by compaction

 Shuffle memory contents to place all free


memory together in one large block
 Compaction is possible only if relocation is dynamic, and is done at
execution time
 I/O problem
 Latch job in memory while it is involved in I/O
 Do I/O only into OS buffers
 Now consider that backing store has
same fragmentation problems

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Segmentation
 Memory-management scheme that supports user view of memory
 A program is a collection of segments
 A segment is a logical unit such as:
• Main program procedure function
• Method
• object
• local variables,
• global variables
• common block
• stack
• symbol table
• Arrays

User’s View of a Program

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Segmentation Architecture
 Logical address consists of a two tuple:
<segment-number, offset>, Logical View of
 Segment table – maps two-dimensional Segmentation
physical addresses; each table entry has:
 base – contains the starting physical
address where the segments reside in
memory
 limit – specifies the length of the
segment
 Segment-table base register (STBR) points
to the segment table’s location in memory
use space
 Segment-table length register (STLR)
indicates number of segments used by a
program;
segment number s is legal if s < STLR

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Segmentation Architecture
 Protection
 With each entry in
segment table associate:
 validation bit = 0  illegal
segment
 read/write/execute
privileges
 Protection bits associated with
segments; code sharing occurs at
segment level
 Since segments vary in length,
memory allocation is a dynamic
storage-allocation problem
Segmentation Hardware
 A segmentation example is shown
in the following diagram

CS3451-IOS/ V. REVATHY / AP-CSE /AEC


Thank You
CS3451-IOS/ V. REVATHY / AP-CSE /AEC

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy