SlideShare a Scribd company logo
1 of 67
MODULE 5
Chapter 12
Secondary storage structure
Magnetic Disks
Magnetic disks provide the bulk of secondary storage for modern
computer systems. They are relatively simple.
 Each disk platter has a flat circular shape,
like a CD . The two surfaces of a platter are
covered with a magnetic material.
 A read -write head "files" just above each
surface of every platter.
 The heads are attached to a disk arm that
moves all the heads as a unit.
 The surface of a platter is logically divided into
circular tracks which are subdivided into
sectors.
Magnetic Disks
When the disk is in use, a drive motor spins it at high speed .
Drives rotate at 60 to 250 times per second.
Disk speed has two parts :
– Transfer rate is the rate at which data flow between drive and
the computer.
– Positioning time (random-access time) is the time to move disk
arm to desired cylinder .
-- Rotational latency is the time for the desired sector to rotate
to the disk head.
 Disk platters are coated with a thin protective layer, the head
will damage the magnetic surface. This accident is called head
crash.
Magnetic Tape
• Magnetic tape was used as an early secondary-storage medium
It is relatively permanent and holds large quantities of data.
• Its access time is slow compared with that of main memory and
magnetic disk.
• Mainly used for backup, for storage of infrequently-used data,
and used as a medium for transferring information from one
system to another.
Disk Structure
• Disk drives are addressed as large 1-dimensional arrays of
logical blocks, where the logical block is the smallest unit of
transfer.
• The 1-dimensional array of logical blocks is mapped into the
sectors of the disk sequentially.
– Sector 0 is the first sector of the first track on the outermost
cylinder.
– Mapping proceeds in order through that track, then the rest
of the tracks in that cylinder, and then through the rest of
the cylinders from outermost to innermost.
– Logical to physical address should be easy.
Disk Scheduling
• The operating system is responsible for using hardware
efficiently — for the disk drives, this means having a fast access
time and disk bandwidth
• The seek access time has two components : Seek time and seek
distance.
• Seek time is the time for the disk arm to move the heads to the
cylinder containing the desired sector.
• Disk bandwidth is the total number of bytes transferred, divided
by the total time between the first request for service and the
completion of the last transfer
Disk Scheduling
 FCFS : First come first served algorithm is fair but it does not
provide the fastest service.
 SCAN (Elevator) algorithm :
 The disk arm starts at one end of the disk and moves towards
the other end , servicing requests as it reaches each cylinder ,
until gets to other end of the disk.
 At the other end direction of head movement is reversed and
servicing continues.
 The disk arm behaves like a elevator in building , first servicing
all the requests going up and then reversing to service requests
the other way.
Disk Scheduling
 C SCAN scheduling:
 Moves the head from one end of the disk to other servicing the
requests along the way.
 When the head reaches the other end, it immediately returns to
the beginning of the disk without servicing any requests on the
return trip.
 SSTF(Shortest seek time first) : It selects the request with the
least seek time from the current head position.
 LOOK scheduling :
 The arm goes only as far as the final request in each direction .
Then it reverses direction immediately without going all the way
to the end of the disk
Disk Attachment
• Computers access disk storage in 2 ways
---Input/output ports
---Remote host in a distributed file system(Network attached
storage/Storage area network)
Network-Attached Storage
• An important benefit of NAS is its ability to provide multiple clients
on the network with access to the same files.
• A NAS is like having a private cloud in the office . Here data may be
accessed remotely using a network connection, meaning
employees can work anywhere and any time.
• It is faster, less expensive and data is continually accessible, makes
it easy for the employees to collaborate, respond to customers in a
timely fashion.
Storage Area Network
• A storage-area network (SAN) is a private network connecting
servers and storage units.
• Multiple hosts and multiple storage arrays can attach to the same
SAN, and storage can be dynamically allocated to hosts.
• If a host is running low on disk space, the SAN can be configured to
allocate more storage to that host.
• SANs make it possible for clusters of servers to share the same
storage and for storage arrays to include multiple direct host
connections.
Disk Management
 Disk Formatting :
• A new magnetic disk is a blank state : it is just a platter of
magnetic recording material.
• Before a disk can store data, it must be divided into sectors that
the disk controller can read and write. This process is called low
level formatting.
• The data structure for each sector: header, trailer and data area.
• The header and trailer contains information used by the disk
controller such as sector number and an error correcting code.
Disk Management
• When the controller writes a sector of data ,the ECC is updated
with a value calculated from all the bytes in data area.
• When the sector is read, the ECC is recalculated and compared
with the stored value.
• If the stored and calculated numbers are different, mismatch
indicates that the data area of the sector has become corrupted
and that the disk sector may be bad.
Boot block
• When a computer is powered up ,it must have initial program
to run (bootstrap program ).
• Bootstrap program finds the operating system kernel on disk ,
loads that kernel in to memory and jumps to an initial address
to begin operating system execution.
• The full bootstrap program is stored in the “boot blocks” at a
fixed location on the disk.
• A disk that has a boot partition is called a boot disk/system
disk..
• The Windows 2000 system places its boot code in the first
sector on the hard disk (master boot record).
Booting from a Disk in Windows 2000
 Windows 2000 allows a hard disk to be divided into one or
more partitions.
 Booting begins in a Windows 2000 system by running code
that is resident in the system's ROM memory.
 This code directs the system to read the boot code from the
MBR.
 In addition to containing boot code, the MBR contains a table
listing the partitions for the hard disk and a flag indicating
which partition the system is to be booted
Bad blocks
• Because disks have moving parts and small tolerances they are
prone to failure .
• When a failure happens, the disk needs to be replaced and its
contents restored from backup media to the new disk.
• Blocks are handled in a variety of ways.
1. MS-DOS format command performs logical formatting and, as a
part of the process, scans the disk to find bad blocks.
 If format finds a bad block, it will tell the allocation routines not
to use that block.
2. Low-level formatting also sets aside spare sectors not visible to
the operating system.
Bad blocks
 The controller can be told to replace each bad sector logically
with one of the spare sectors. This scheme is known as sector
sparing/forwarding.
3. A typical bad-sector transaction might be as follows:
• The operating system tries to read logical block 87.
• The controller calculates the ECC and finds that the sector is bad.
It reports this finding to the operating system.
• The next time the system is rebooted, a special command is run
to tell the SCSI controller to replace the bad sector with a spare.
• After that, whenever the system requests logical block 87, the
request is translated into the replacement sector's address by
the controller.
Swap space management
• It is another low level task of OS , virtual memory uses disk
space as an extension of main memory.
• Disk access is much slower than memory access using swap
space significantly decreases system performance.
• Swap space Use: Systems that implement swapping may use
swap space to hold an entire process image including the code
and data segments.
• Paging systems may simply store pages that have been pushed
out of main memory.
• The amount of swap space needed on a system can therefore
vary from a few megabytes of disk space to gigabytes
depending on the amount of physical memory.
Swap space location
• A swap space can reside in one of 2 places: it can be of normal file
system or it can be in a separate disk partition.
• If the swap space is simply a large file within the file system, normal
file-system routines can be used to create it, name it and allocate its
space.
• This approach is easy to implement and is inefficient.
• Swap space can be created in a separate partition.
• Swap space storage manager is used to allocate & de allocate the
blocks from raw partition.
Swap space management : An Example
Data Structures for Swapping on Linux Systems
• Each swap area consists of a series of 4-KB which are used to hold
swapped pages.
• Associated with each swap is a swap area - an array of integer
counters, each corresponding to a page slot in the swap area.
• Values greater than 0 indicate that the page slot is occupied by a
swapped page.
• The value of the counter indicates the number of mappings to the
swapped page; for example, a value of 3 indicates that the swapped
page is mapped to three different processes.
Chapter 14
Protection And Security
Goals of Protection
• We need to ensure that each program component active in a
system uses system resources only in the way consistent with
stated policies.
• Protection can improve reliability by detecting errors at the
interfaces between component subsystems.
• Policies for resource use may vary by application, and they may
change over time.
• Mechanisms are distinct from policies. Mechanisms determine
how to do something; policies decide what will be done.
• Policies are likely to change from place to place or time to time.
every change in policy would require a change in the underlying
mechanism.
Principles of Protection
• Guiding principle for protection is the principle of least privilege. It
dictates that programs, users, and even systems be given just
enough privileges to perform their tasks.
• Example : Security guard with a passkey. If this key allows the
guard into just the public areas that she guards, then misuse of
the key will result in minimal damage.
• The passkey allows access to all areas, then damage from its being
lost, stolen, misused, copied, or otherwise compromise will be
much greater.
• An operating system follows the principle of least privilege.
Principles of Protection
• Managing users with the principle of least privilege entails
creating a separate account for each user, with just the privileges
that the user needs.
• An operator who needs to mount tapes and back up files on the
system has access to just those commands and files needed to
accomplish the job.
 Domain of Protection
• A computer system is a collection of processes and
objects(hardware and software objects).
• Each object has a unique name and each can be accessed only
through well-defined and meaningful operations.
Domain of Protection
• The operations that are possible may depend on the object .
E.g. : On a CPU, we can only execute, Data files can be created,
opened, read, written, closed, and deleted, Program files can be
read, written, executed, and deleted.
• At any time, a process should be able to access only those
resources that it currently requires to complete its task.
• Need-to-know principle :
When process p invokes procedure A(), the procedure should be
allowed to access only its own variables and the formal parameters
passed to it; it should not be able to access all the variables of
process p.
Domain Structure
• A process operates within a protection domain which specifies
the resources that the process may access.
• Each domain defines a set of objects and the types of operations
that may be invoked on each object. The ability to execute an
operation on an object is an access right.
• A domain is a collection of access rights, each of which is an
ordered pair <object-name, rights-set>.
• For example, if domain D has the access right <file F, {read,
write}>, then a process executing in domain D can both read and
write file F; it cannot perform any other operation on that
object.
Domain Structure
• Domains do not need to be disjoint; they may share access rights.
• If the association between process and domain is dynamic, a
mechanism is available to allow enabling the process to switch
from one domain to another.
• We may want to allow the content of a domain need to be
changed . We can do this by creating a new domain with the
changed content and switching to that new domain.
Domain Structure
 A domain can be realized in a variety of ways:
• User : Each user may be a domain. Domain switching occurs
when the user is changed-generally when one user logs out and
another user logs in.
• Process : Each process may be a domain. Domain switching
occurs when one process sends a message to another process
and then waits for a response.
• Procedure :Each procedure may be a domain. Domain switching
occurs when a procedure call is made.
Domain Implementation(MULTICS)
• Protection domains are organized hierarchically in to a ring
structure. The rings are numbered from 0 to 7.
• Let Di and Dj be any two domain rings.
• If j < i, then Di is a subset of Dj – i.e a process executing in
domain Dj has more privileges than does a process executing in
domain Di.
• MULTICS has segment address space, each segment is a file
and segment is associated with one of the rings.
• A current-ring-number counter is associated with each
process, identifying the ring in which the process is executing
currently.
• When a process is executing in ring i, it cannot access a
segment associated with ring j (j < i). It can access a segment
associated with ring k (k>= i).
• Domain switching in MULTICS occurs when a process crosses
from one ring to another by calling a procedure in a different
ring.
• We modify the ring field of the segment descriptor which includes
the following .
• Access bracket : A pair of integers, b1 and b2, such that b1<= b2.
• Limit : An integer b3 such that b3 > b2.
• List of gates: Identifies the entry points at which segments may be
called.
• If a process executing in ring i calls a procedure with access bracket
(b1,b2), then the call is allowed if b1<=i<=b2, and the current ring
number of the process remains i.
• Otherwise, a trap to the operating system occurs, situation can be
handled as follows : if i<b1 and i>b2 then call is allowed by copying
from one segment area to another.
Access Matrix
• View protection as a matrix (access matrix).
• Rows represent domains. Columns represent objects.
• Access(i, j) is the set of operations that a process executing in
Domaini can invoke on Objectj.
Access Matrix of Figure A with Domains as
Objects
 Domain Switching : Switching from domain Di to Dj is allowed only
if the access right switch belongs to (i,j).
Operations on access matrix entries
 The ability to copy an access right from one domain (or row) of the
access matrix to another is denoted by an asterisk (*) appended to
the access right.
 The copy right allows the access right to be copied only within the
column for which the right is defined.
Operations on access matrix entries
 If access(i, j) includes the owner right, then a process executing in
domain Di can add and remove any right in any entry in column j.
 The copy and owner rights allow a process to change the entries in a
column.
Operations on access matrix entries
The control right is applicable only to domain objects and change
the entries in a row.
 If access(i, j) includes the control right, then a process executing in
domain Di can remove any access right from row j.
 Control right in access(D2, D4) then, a process executing in
domain D2 could modify domain D4.
Modified Access Matrix of Figure B
Implementation of Access Matrix
 Global Table : Consists of ordered triples <domain , object, rights-
set> . Whenever an operation M is executed on an object Oj within
domain D, the global table is searched.
• If this triple is found, the operation is allowed to continue;
otherwise, an exception (or error) condition is raised.
 Disadvantage :
• The table is usually large and thus cannot be kept in main memory,
so additional I/0 is needed.
• It is difficult to take advantage of special groupings of objects or
domains.
Implementation of Access Matrix
 Global Table : Consists of ordered triples <domain , object, rights-
set> . Whenever an operation M is executed on an object Oj within
domain D, the global table is searched.
• If this triple is found, the operation is allowed to continue;
otherwise, an exception (or error) condition is raised.
 Disadvantage :
• The table is usually large and thus cannot be kept in main memory,
so additional I/O is needed.
• It is difficult to take advantage of special groupings of objects or
domains.
Implementation of Access Matrix
• Access Lists for Objects : Each object consists of ordered pairs
<domain, rights-set>, which define all domains with a nonempty set
of access rights for that object.
• Access control list for one object
defines who can perform what operation.
When an operation M on an object Oi is attempted in domain Di,
we search the access list for object Oj, looking for an entry < Di, Rk >
with .
• If the entry is found, we allow the operation; otherwise exception is
caught.
Implementation of Access Matrix (Cont.)
• Capability lists for domains : It is a list of objects together with the
operations allowed on those objects.
• An object is often represented by its physical name or address,
called a capability.
• To execute operation M on object 0j, the process executes the
operation M, specifying the capability for object 0j as parameter.
• Each Row = Capability List (like a key)
For each domain, what operations allowed on what objects
Object F1 – Read
Object F4 – Read, Write, Execute
Object F5 – Read, Write, Delete, Copy
Implementation of Access Matrix (Cont.)
 Lock-key Mechanism
– It is a compromise between access lists and capability lists.
– Each object has a list of unique bit patterns, called locks.
– Each domain has a list of unique bit patterns called keys.
– Process in a domain can only access object if domain has key
that with matches one of the locks.
Comparison of Implementations
 Disadvantages :
– Global table is simple, but can be large and require huge
amount of memory.
– Access lists correspond to needs of users.
• Every access to an object must be checked.
– Many objects and access rights -> slow.
– Capability lists useful for localizing information for a given
process.
– Lock-key mechanism is effective and flexible since keys can
be passed freely from domain to domain,.
Access Control
• Oracle Solaris 10 provides role-based access control
(RBAC) to implement least privileges.
– Privilege is the right to execute system call or
use an option within a system call.
– Can be assigned to processes, limiting them to
exactly the access they need to perform their
work.
– Users are assigned roles or can take roles based
on passwords to the roles.
– User can take a role that enables a privilege
allowing the user to run a program to
accomplish a specific task.
Revocation of Access Rights
 Various options to remove the access right of a domain to an
object.
• Immediate versus delayed: Does revocation occur immediately,
or is it delayed? If revocation is delayed, can we find out when it
will take place?
• Selective versus general : When an access right to an object is
revoked, does it affect all the users who have an access right to
that object, or can we specify a group of users whose access
rights should be revoked?
• Partial versus total: Can a subset of the rights associated with an
object be revoked, or must we revoke all access rights for this
object?
• Temporary versus permanent : Can access be revoked
permanently or can access be revoked and later be obtained
again?
Revocation of Access Rights (Cont.)
 Capability List – It is a scheme required to locate capability in the
system before it can be revoked.
• Reacquisition – capabilities are deleted from each domain. If a
process wants to use a capability, it may find that capability has
been deleted. The process may then try to reacquire the
capability.
• Back-pointers - A list of pointers is maintained with each object,
pointing to all capabilities associated with that object. When
revocation is required, we can follow these pointers.
• Indirection - The capabilities point indirectly, not directly, to the
objects. Each capability points to a unique entry in a global table,
which in turn points to the object.
MODULE 5
Chapter 18
Linux System
Linux History
• Linux is a modern, free operating system based on UNIX standards.
• First developed as a small but self-contained kernel in 1991 by Linus
Torvalds, with the major design goal of UNIX compatibility, released
as open source.
• It has been designed to run efficiently and reliably on common PC
hardware, but also runs on a variety of other platforms.
• The core Linux operating system kernel is entirely original, but it can
run much existing free UNIX software, resulting in an entire UNIX-
compatible operating system free from proprietary code.
• Linux system has many, varying Linux distributions including the
kernel, applications, and management tools
Linux 2.0
• Released in June 1996, 2.0 added two major new capabilities:
– Support for multiple and multiprocessor architectures.
– Improved memory-management code.
– Improved TCP/IP performance
– Standardized configuration interface.
• Available for Motorola 68000-series processors, Sun Sparc systems,
and for PC and PowerMac systems.
• 2.4 and 2.6 increased SMP support, added journaling file system,
preemptive kernel, 64-bit memory support.
• 3.0 released in 2011, 20th anniversary of Linux, improved
virtualization support, improved memory management.
Linux Distributions
• Standard, precompiled sets of packages, or distributions, include
the basic Linux system, system installation and management
utilities, and ready-to-install packages of common UNIX tools.
• The first distributions managed these packages by simply
providing a means of unpacking all the files into the appropriate
places; modern distributions include advanced package
management.
• Early distributions included SLS and Slackware
– Red Hat and Debian are popular distributions from
commercial and noncommercial sources, respectively, others
include Canonical and SuSE.
• The RPM Package file format permits compatibility among the
Design Principles
• Linux is a multiuser, multitasking system with a full set of UNIX-
compatible tools.
• Its file system adheres to traditional UNIX semantics, and it fully
implements the standard UNIX networking model.
• Main design goals are speed, efficiency, and standardization.
• Linux is designed to be compliant with the relevant POSIX documents;
at least two Linux distributions have achieved official POSIX
certification.
– Supports Pthreads and a subset of POSIX real-time process control.
• The Linux programming interface adheres to the SVR4 UNIX
semantics, rather than to BSD behavior
Components of a Linux System
Components of a Linux System
Like most UNIX implementations, Linux is composed of three main
bodies of code; the most important distinction between the kernel
and all other components.
The kernel is responsible for maintaining the important abstractions
of the operating system.
Kernel code executes in kernel mode with full access to all the
physical resources of the computer.
All kernel code and data structures are kept in the same single
address space.
Components of a Linux System (Cont.)
• The system libraries define a standard set of functions through
which applications interact with the kernel, and which implement
much of the operating-system functionality that does not need the
full privileges of kernel code.
• The system utilities perform individual specialized management
tasks.
• User-mode programs rich and varied, including multiple shells like
the bourne-again (bash)
Process Management
• UNIX process management separates the creation of processes and
the running of a new program into two distinct operations.
– The fork() system call creates a new process
– A new program is run after a call to exec().
• Under UNIX, a process encompasses all the information that the
operating system must maintain to track the context of a single
execution of a single program.
• Under Linux, process properties fall into three groups: the
process’s identity, environment, and context
Process Identity
• Process ID (PID) - The unique identifier for the process; used to
specify processes to the operating system when an application
makes a system call to signal, modify, or wait for another process.
• Credentials - Each process must have an associated user ID and
one or more group IDs that determine the process’s rights to
access system resources and files.
• Personality - Not traditionally found on UNIX systems, but under
Linux each process has an associated personality identifier that can
slightly modify the semantics of certain system calls.
– Used primarily by emulation libraries to request that system
calls be compatible with certain specific flavors of UNIX.
• Namespace – Specific view of file system hierarchy
– Most processes share common namespace and operate on a
shared file-system hierarchy.
– But each can have unique file-system hierarchy with its own root
directory and set of mounted file systems.
Process Environment
• The process’s environment is inherited from its parent, and is
composed of two null-terminated vectors:
– The argument vector lists the command-line arguments used to
invoke the running program; conventionally starts with the name
of the program itself.
– The environment vector is a list of “NAME=VALUE” pairs that
associates named environment variables with arbitrary textual
values.
• Passing environment variables among processes and inheriting
variables by a process’s children are flexible means of passing
information to components of the user-mode system software.
• The environment-variable mechanism provides a customization of
the operating system that can be set on a per-process basis, rather
than being configured for the system as a whole.
Process Context
• The (constantly changing) state of a running program at any point
in time.
• The scheduling context is the most important part of the process
context; it is the information that the scheduler needs to suspend
and restart the process.
• The kernel maintains accounting information about the resources
currently being consumed by each process, and the total
resources consumed by the process in its lifetime so far.
• The file table is an array of pointers to kernel file structures
– When making file I/O system calls, processes refer to files by
their index into this table, the file descriptor (fd)
Process Context (Cont.)
• Whereas the file table lists the existing open files, the
file-system context applies to requests to open new files
– The current root and default directories to be used for new file
searches are stored here.
• The signal-handler table defines the routine in the process’s address
space to be called when specific signals arrives.
• The virtual-memory context of a process describes the full contents
of the its private address space
Kernel Modules
• Sections of kernel code that can be compiled, loaded, and unloaded
independent of the rest of the kernel.
• A kernel module may typically implement a device driver, a file
system, or a networking protocol.
• The module interface allows third parties to write and distribute, on
their own terms, device drivers or file systems that could not be
distributed under the GPL.
• Kernel modules allow a Linux system to be set up with a standard,
minimal kernel, without any extra device drivers built in.
Module Management
• Four components to Linux module support:
– module-management system
– module loader and unloader
– driver-registration system
– conflict-resolution mechanism
• Supports loading modules into memory and letting them talk to the
rest of the kernel.
• Module loading is split into two separate sections:
– Managing sections of module code in kernel memory
– Handling symbols that modules are allowed to reference
• The module requestor manages loading requested, but currently
unloaded, modules; it also regularly queries the kernel to see
whether a dynamically loaded module is still in use, and will unload
it when it is no longer actively needed.
Driver Registration
• Allows modules to tell the rest of the kernel that a new driver has
become available.
• The kernel maintains dynamic tables of all known drivers, and
provides a set of routines to allow drivers to be added to or
removed from these tables at any time.
• Registration tables include the following items:
– Device drivers
– File systems
– Network protocols
– Binary format
Conflict Resolution
• A mechanism that allows different device drivers to
reserve hardware resources and to protect those
resources from accidental use by another driver.
• The conflict resolution module aims to:
– Prevent modules from clashing over access to hardware
resources
– Prevent autoprobes from interfering with existing device
drivers
– Resolve conflicts with multiple drivers trying to access the
same hardware:
1. Kernel maintains list of allocated HW resources
2. Driver reserves resources with kernel database first
3. Reservation request rejected if resource not available
Process Management
• UNIX process management separates the
creation of processes and the running of a new
program into two distinct operations.
– The fork() system call creates a new process
– A new program is run after a call to exec()
• Under UNIX, a process encompasses all the
information that the operating system must
maintain to track the context of a single
execution of a single program
• Under Linux, process properties fall into three
groups: the process’s identity, environment,
and context
Process Identity
• Process ID (PID) - The unique identifier for the process;
used to specify processes to the operating system when
an application makes a system call to signal, modify, or
wait for another process
• Credentials - Each process must have an associated user
ID and one or more group IDs that determine the
process’s rights to access system resources and files
• Personality - Not traditionally found on UNIX systems, but
under Linux each process has an associated personality
identifier that can slightly modify the semantics of certain
system calls
– Used primarily by emulation libraries to request that system
calls be compatible with certain specific flavors of UNIX
• Namespace – Specific view of file system hierarchy
– Most processes share common namespace and operate on
a shared file-system hierarchy
– But each can have unique file-system hierarchy with its own
root directory and set of mounted file systems
Process Environment
• The process’s environment is inherited from its parent,
and is composed of two null-terminated vectors:
– The argument vector lists the command-line arguments
used to invoke the running program; conventionally starts
with the name of the program itself.
– The environment vector is a list of “NAME=VALUE” pairs
that associates named environment variables with arbitrary
textual values.
• Passing environment variables among processes and
inheriting variables by a process’s children are flexible
means of passing information to components of the user-
mode system software.
• The environment-variable mechanism provides a
customization of the operating system that can be set on a
per-process basis, rather than being configured for the
system as a whole.
Process Context
• The (constantly changing) state of a running
program at any point in time
• The scheduling context is the most important part
of the process context; it is the information that
the scheduler needs to suspend and restart the
process
• The kernel maintains accounting information
about the resources currently being consumed by
each process, and the total resources consumed
by the process in its lifetime so far
• The file table is an array of pointers to kernel file
structures
– When making file I/O system calls, processes refer to
files by their index into this table, the file descriptor
(fd)
Process Context (Cont.)
• Whereas the file table lists the existing open
files, the
file-system context applies to requests to
open new files
– The current root and default directories to be
used for new file searches are stored here
• The signal-handler table defines the routine
in the process’s address space to be called
when specific signals arrive
• The virtual-memory context of a process
describes the full contents of the its private
address space

More Related Content

What's hot

04.01 file organization
04.01 file organization04.01 file organization
04.01 file organizationBishal Ghimire
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Operation System
Operation SystemOperation System
Operation SystemANANTHI1997
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OSC.U
 
Sheik Mohamed Shadik - BSc - Project Details
Sheik Mohamed Shadik - BSc - Project DetailsSheik Mohamed Shadik - BSc - Project Details
Sheik Mohamed Shadik - BSc - Project Detailsshadikbsc
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementAjit Nayak
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsPeter Tröger
 
disk sechduling
disk sechdulingdisk sechduling
disk sechdulinggopi7
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
db
dbdb
dbAisu
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Anwal Mirza
 

What's hot (18)

04.01 file organization
04.01 file organization04.01 file organization
04.01 file organization
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Operation System
Operation SystemOperation System
Operation System
 
Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
 
Os
OsOs
Os
 
I/O structure slide by Rajalakshmi SKC
I/O structure slide by Rajalakshmi SKCI/O structure slide by Rajalakshmi SKC
I/O structure slide by Rajalakshmi SKC
 
Operation System
Operation SystemOperation System
Operation System
 
7 disk managment
7 disk managment7 disk managment
7 disk managment
 
Disk Management
Disk ManagementDisk Management
Disk Management
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
Sheik Mohamed Shadik - BSc - Project Details
Sheik Mohamed Shadik - BSc - Project DetailsSheik Mohamed Shadik - BSc - Project Details
Sheik Mohamed Shadik - BSc - Project Details
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management Concepts
 
disk sechduling
disk sechdulingdisk sechduling
disk sechduling
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
db
dbdb
db
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
 

Similar to Module5 secondary storage

Similar to Module5 secondary storage (20)

Disk Management through the Computer Management
Disk Management through the Computer ManagementDisk Management through the Computer Management
Disk Management through the Computer Management
 
Os7
Os7Os7
Os7
 
OS_Ch14
OS_Ch14OS_Ch14
OS_Ch14
 
Ch14 OS
Ch14 OSCh14 OS
Ch14 OS
 
Os
OsOs
Os
 
Ch9 mass storage systems
Ch9   mass storage systemsCh9   mass storage systems
Ch9 mass storage systems
 
Mass storage systemsos
Mass storage systemsosMass storage systemsos
Mass storage systemsos
 
18CSC205J-UNIT-5.pptx
18CSC205J-UNIT-5.pptx18CSC205J-UNIT-5.pptx
18CSC205J-UNIT-5.pptx
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
Auxiliary, Cache and Virtual memory.pptx
Auxiliary, Cache and Virtual memory.pptxAuxiliary, Cache and Virtual memory.pptx
Auxiliary, Cache and Virtual memory.pptx
 
Mass Storage Structure
Mass Storage StructureMass Storage Structure
Mass Storage Structure
 
Disk Architecture.pptx
Disk Architecture.pptxDisk Architecture.pptx
Disk Architecture.pptx
 
19IS305_U4_LP10_LM10-22-23.pdf
19IS305_U4_LP10_LM10-22-23.pdf19IS305_U4_LP10_LM10-22-23.pdf
19IS305_U4_LP10_LM10-22-23.pdf
 
Cs8493 unit 4
Cs8493 unit 4Cs8493 unit 4
Cs8493 unit 4
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for all
 
Massstorage
MassstorageMassstorage
Massstorage
 
Os
OsOs
Os
 
Viknesh
VikneshViknesh
Viknesh
 

Recently uploaded

What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 

Recently uploaded (20)

What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 

Module5 secondary storage

  • 1. MODULE 5 Chapter 12 Secondary storage structure
  • 2. Magnetic Disks Magnetic disks provide the bulk of secondary storage for modern computer systems. They are relatively simple.  Each disk platter has a flat circular shape, like a CD . The two surfaces of a platter are covered with a magnetic material.  A read -write head "files" just above each surface of every platter.  The heads are attached to a disk arm that moves all the heads as a unit.  The surface of a platter is logically divided into circular tracks which are subdivided into sectors.
  • 3. Magnetic Disks When the disk is in use, a drive motor spins it at high speed . Drives rotate at 60 to 250 times per second. Disk speed has two parts : – Transfer rate is the rate at which data flow between drive and the computer. – Positioning time (random-access time) is the time to move disk arm to desired cylinder . -- Rotational latency is the time for the desired sector to rotate to the disk head.  Disk platters are coated with a thin protective layer, the head will damage the magnetic surface. This accident is called head crash.
  • 4. Magnetic Tape • Magnetic tape was used as an early secondary-storage medium It is relatively permanent and holds large quantities of data. • Its access time is slow compared with that of main memory and magnetic disk. • Mainly used for backup, for storage of infrequently-used data, and used as a medium for transferring information from one system to another.
  • 5. Disk Structure • Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. • The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially. – Sector 0 is the first sector of the first track on the outermost cylinder. – Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost. – Logical to physical address should be easy.
  • 6. Disk Scheduling • The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk bandwidth • The seek access time has two components : Seek time and seek distance. • Seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector. • Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of the last transfer
  • 7. Disk Scheduling  FCFS : First come first served algorithm is fair but it does not provide the fastest service.  SCAN (Elevator) algorithm :  The disk arm starts at one end of the disk and moves towards the other end , servicing requests as it reaches each cylinder , until gets to other end of the disk.  At the other end direction of head movement is reversed and servicing continues.  The disk arm behaves like a elevator in building , first servicing all the requests going up and then reversing to service requests the other way.
  • 8. Disk Scheduling  C SCAN scheduling:  Moves the head from one end of the disk to other servicing the requests along the way.  When the head reaches the other end, it immediately returns to the beginning of the disk without servicing any requests on the return trip.  SSTF(Shortest seek time first) : It selects the request with the least seek time from the current head position.  LOOK scheduling :  The arm goes only as far as the final request in each direction . Then it reverses direction immediately without going all the way to the end of the disk
  • 9. Disk Attachment • Computers access disk storage in 2 ways ---Input/output ports ---Remote host in a distributed file system(Network attached storage/Storage area network)
  • 10. Network-Attached Storage • An important benefit of NAS is its ability to provide multiple clients on the network with access to the same files. • A NAS is like having a private cloud in the office . Here data may be accessed remotely using a network connection, meaning employees can work anywhere and any time. • It is faster, less expensive and data is continually accessible, makes it easy for the employees to collaborate, respond to customers in a timely fashion.
  • 11. Storage Area Network • A storage-area network (SAN) is a private network connecting servers and storage units. • Multiple hosts and multiple storage arrays can attach to the same SAN, and storage can be dynamically allocated to hosts. • If a host is running low on disk space, the SAN can be configured to allocate more storage to that host. • SANs make it possible for clusters of servers to share the same storage and for storage arrays to include multiple direct host connections.
  • 12. Disk Management  Disk Formatting : • A new magnetic disk is a blank state : it is just a platter of magnetic recording material. • Before a disk can store data, it must be divided into sectors that the disk controller can read and write. This process is called low level formatting. • The data structure for each sector: header, trailer and data area. • The header and trailer contains information used by the disk controller such as sector number and an error correcting code.
  • 13. Disk Management • When the controller writes a sector of data ,the ECC is updated with a value calculated from all the bytes in data area. • When the sector is read, the ECC is recalculated and compared with the stored value. • If the stored and calculated numbers are different, mismatch indicates that the data area of the sector has become corrupted and that the disk sector may be bad.
  • 14. Boot block • When a computer is powered up ,it must have initial program to run (bootstrap program ). • Bootstrap program finds the operating system kernel on disk , loads that kernel in to memory and jumps to an initial address to begin operating system execution. • The full bootstrap program is stored in the “boot blocks” at a fixed location on the disk. • A disk that has a boot partition is called a boot disk/system disk.. • The Windows 2000 system places its boot code in the first sector on the hard disk (master boot record).
  • 15. Booting from a Disk in Windows 2000  Windows 2000 allows a hard disk to be divided into one or more partitions.  Booting begins in a Windows 2000 system by running code that is resident in the system's ROM memory.  This code directs the system to read the boot code from the MBR.  In addition to containing boot code, the MBR contains a table listing the partitions for the hard disk and a flag indicating which partition the system is to be booted
  • 16. Bad blocks • Because disks have moving parts and small tolerances they are prone to failure . • When a failure happens, the disk needs to be replaced and its contents restored from backup media to the new disk. • Blocks are handled in a variety of ways. 1. MS-DOS format command performs logical formatting and, as a part of the process, scans the disk to find bad blocks.  If format finds a bad block, it will tell the allocation routines not to use that block. 2. Low-level formatting also sets aside spare sectors not visible to the operating system.
  • 17. Bad blocks  The controller can be told to replace each bad sector logically with one of the spare sectors. This scheme is known as sector sparing/forwarding. 3. A typical bad-sector transaction might be as follows: • The operating system tries to read logical block 87. • The controller calculates the ECC and finds that the sector is bad. It reports this finding to the operating system. • The next time the system is rebooted, a special command is run to tell the SCSI controller to replace the bad sector with a spare. • After that, whenever the system requests logical block 87, the request is translated into the replacement sector's address by the controller.
  • 18. Swap space management • It is another low level task of OS , virtual memory uses disk space as an extension of main memory. • Disk access is much slower than memory access using swap space significantly decreases system performance. • Swap space Use: Systems that implement swapping may use swap space to hold an entire process image including the code and data segments. • Paging systems may simply store pages that have been pushed out of main memory. • The amount of swap space needed on a system can therefore vary from a few megabytes of disk space to gigabytes depending on the amount of physical memory.
  • 19. Swap space location • A swap space can reside in one of 2 places: it can be of normal file system or it can be in a separate disk partition. • If the swap space is simply a large file within the file system, normal file-system routines can be used to create it, name it and allocate its space. • This approach is easy to implement and is inefficient. • Swap space can be created in a separate partition. • Swap space storage manager is used to allocate & de allocate the blocks from raw partition.
  • 20. Swap space management : An Example Data Structures for Swapping on Linux Systems • Each swap area consists of a series of 4-KB which are used to hold swapped pages. • Associated with each swap is a swap area - an array of integer counters, each corresponding to a page slot in the swap area. • Values greater than 0 indicate that the page slot is occupied by a swapped page. • The value of the counter indicates the number of mappings to the swapped page; for example, a value of 3 indicates that the swapped page is mapped to three different processes.
  • 22. Goals of Protection • We need to ensure that each program component active in a system uses system resources only in the way consistent with stated policies. • Protection can improve reliability by detecting errors at the interfaces between component subsystems. • Policies for resource use may vary by application, and they may change over time. • Mechanisms are distinct from policies. Mechanisms determine how to do something; policies decide what will be done. • Policies are likely to change from place to place or time to time. every change in policy would require a change in the underlying mechanism.
  • 23. Principles of Protection • Guiding principle for protection is the principle of least privilege. It dictates that programs, users, and even systems be given just enough privileges to perform their tasks. • Example : Security guard with a passkey. If this key allows the guard into just the public areas that she guards, then misuse of the key will result in minimal damage. • The passkey allows access to all areas, then damage from its being lost, stolen, misused, copied, or otherwise compromise will be much greater. • An operating system follows the principle of least privilege.
  • 24. Principles of Protection • Managing users with the principle of least privilege entails creating a separate account for each user, with just the privileges that the user needs. • An operator who needs to mount tapes and back up files on the system has access to just those commands and files needed to accomplish the job.  Domain of Protection • A computer system is a collection of processes and objects(hardware and software objects). • Each object has a unique name and each can be accessed only through well-defined and meaningful operations.
  • 25. Domain of Protection • The operations that are possible may depend on the object . E.g. : On a CPU, we can only execute, Data files can be created, opened, read, written, closed, and deleted, Program files can be read, written, executed, and deleted. • At any time, a process should be able to access only those resources that it currently requires to complete its task. • Need-to-know principle : When process p invokes procedure A(), the procedure should be allowed to access only its own variables and the formal parameters passed to it; it should not be able to access all the variables of process p.
  • 26. Domain Structure • A process operates within a protection domain which specifies the resources that the process may access. • Each domain defines a set of objects and the types of operations that may be invoked on each object. The ability to execute an operation on an object is an access right. • A domain is a collection of access rights, each of which is an ordered pair <object-name, rights-set>. • For example, if domain D has the access right <file F, {read, write}>, then a process executing in domain D can both read and write file F; it cannot perform any other operation on that object.
  • 27. Domain Structure • Domains do not need to be disjoint; they may share access rights. • If the association between process and domain is dynamic, a mechanism is available to allow enabling the process to switch from one domain to another. • We may want to allow the content of a domain need to be changed . We can do this by creating a new domain with the changed content and switching to that new domain.
  • 28. Domain Structure  A domain can be realized in a variety of ways: • User : Each user may be a domain. Domain switching occurs when the user is changed-generally when one user logs out and another user logs in. • Process : Each process may be a domain. Domain switching occurs when one process sends a message to another process and then waits for a response. • Procedure :Each procedure may be a domain. Domain switching occurs when a procedure call is made.
  • 29. Domain Implementation(MULTICS) • Protection domains are organized hierarchically in to a ring structure. The rings are numbered from 0 to 7. • Let Di and Dj be any two domain rings. • If j < i, then Di is a subset of Dj – i.e a process executing in domain Dj has more privileges than does a process executing in domain Di.
  • 30. • MULTICS has segment address space, each segment is a file and segment is associated with one of the rings. • A current-ring-number counter is associated with each process, identifying the ring in which the process is executing currently. • When a process is executing in ring i, it cannot access a segment associated with ring j (j < i). It can access a segment associated with ring k (k>= i). • Domain switching in MULTICS occurs when a process crosses from one ring to another by calling a procedure in a different ring.
  • 31. • We modify the ring field of the segment descriptor which includes the following . • Access bracket : A pair of integers, b1 and b2, such that b1<= b2. • Limit : An integer b3 such that b3 > b2. • List of gates: Identifies the entry points at which segments may be called. • If a process executing in ring i calls a procedure with access bracket (b1,b2), then the call is allowed if b1<=i<=b2, and the current ring number of the process remains i. • Otherwise, a trap to the operating system occurs, situation can be handled as follows : if i<b1 and i>b2 then call is allowed by copying from one segment area to another.
  • 32. Access Matrix • View protection as a matrix (access matrix). • Rows represent domains. Columns represent objects. • Access(i, j) is the set of operations that a process executing in Domaini can invoke on Objectj.
  • 33. Access Matrix of Figure A with Domains as Objects  Domain Switching : Switching from domain Di to Dj is allowed only if the access right switch belongs to (i,j).
  • 34. Operations on access matrix entries  The ability to copy an access right from one domain (or row) of the access matrix to another is denoted by an asterisk (*) appended to the access right.  The copy right allows the access right to be copied only within the column for which the right is defined.
  • 35. Operations on access matrix entries  If access(i, j) includes the owner right, then a process executing in domain Di can add and remove any right in any entry in column j.  The copy and owner rights allow a process to change the entries in a column.
  • 36. Operations on access matrix entries The control right is applicable only to domain objects and change the entries in a row.  If access(i, j) includes the control right, then a process executing in domain Di can remove any access right from row j.  Control right in access(D2, D4) then, a process executing in domain D2 could modify domain D4. Modified Access Matrix of Figure B
  • 37. Implementation of Access Matrix  Global Table : Consists of ordered triples <domain , object, rights- set> . Whenever an operation M is executed on an object Oj within domain D, the global table is searched. • If this triple is found, the operation is allowed to continue; otherwise, an exception (or error) condition is raised.  Disadvantage : • The table is usually large and thus cannot be kept in main memory, so additional I/0 is needed. • It is difficult to take advantage of special groupings of objects or domains.
  • 38. Implementation of Access Matrix  Global Table : Consists of ordered triples <domain , object, rights- set> . Whenever an operation M is executed on an object Oj within domain D, the global table is searched. • If this triple is found, the operation is allowed to continue; otherwise, an exception (or error) condition is raised.  Disadvantage : • The table is usually large and thus cannot be kept in main memory, so additional I/O is needed. • It is difficult to take advantage of special groupings of objects or domains.
  • 39. Implementation of Access Matrix • Access Lists for Objects : Each object consists of ordered pairs <domain, rights-set>, which define all domains with a nonempty set of access rights for that object. • Access control list for one object defines who can perform what operation. When an operation M on an object Oi is attempted in domain Di, we search the access list for object Oj, looking for an entry < Di, Rk > with . • If the entry is found, we allow the operation; otherwise exception is caught.
  • 40. Implementation of Access Matrix (Cont.) • Capability lists for domains : It is a list of objects together with the operations allowed on those objects. • An object is often represented by its physical name or address, called a capability. • To execute operation M on object 0j, the process executes the operation M, specifying the capability for object 0j as parameter. • Each Row = Capability List (like a key) For each domain, what operations allowed on what objects Object F1 – Read Object F4 – Read, Write, Execute Object F5 – Read, Write, Delete, Copy
  • 41. Implementation of Access Matrix (Cont.)  Lock-key Mechanism – It is a compromise between access lists and capability lists. – Each object has a list of unique bit patterns, called locks. – Each domain has a list of unique bit patterns called keys. – Process in a domain can only access object if domain has key that with matches one of the locks.
  • 42. Comparison of Implementations  Disadvantages : – Global table is simple, but can be large and require huge amount of memory. – Access lists correspond to needs of users. • Every access to an object must be checked. – Many objects and access rights -> slow. – Capability lists useful for localizing information for a given process. – Lock-key mechanism is effective and flexible since keys can be passed freely from domain to domain,.
  • 43. Access Control • Oracle Solaris 10 provides role-based access control (RBAC) to implement least privileges. – Privilege is the right to execute system call or use an option within a system call. – Can be assigned to processes, limiting them to exactly the access they need to perform their work. – Users are assigned roles or can take roles based on passwords to the roles. – User can take a role that enables a privilege allowing the user to run a program to accomplish a specific task.
  • 44. Revocation of Access Rights  Various options to remove the access right of a domain to an object. • Immediate versus delayed: Does revocation occur immediately, or is it delayed? If revocation is delayed, can we find out when it will take place? • Selective versus general : When an access right to an object is revoked, does it affect all the users who have an access right to that object, or can we specify a group of users whose access rights should be revoked? • Partial versus total: Can a subset of the rights associated with an object be revoked, or must we revoke all access rights for this object? • Temporary versus permanent : Can access be revoked permanently or can access be revoked and later be obtained again?
  • 45. Revocation of Access Rights (Cont.)  Capability List – It is a scheme required to locate capability in the system before it can be revoked. • Reacquisition – capabilities are deleted from each domain. If a process wants to use a capability, it may find that capability has been deleted. The process may then try to reacquire the capability. • Back-pointers - A list of pointers is maintained with each object, pointing to all capabilities associated with that object. When revocation is required, we can follow these pointers. • Indirection - The capabilities point indirectly, not directly, to the objects. Each capability points to a unique entry in a global table, which in turn points to the object.
  • 47. Linux History • Linux is a modern, free operating system based on UNIX standards. • First developed as a small but self-contained kernel in 1991 by Linus Torvalds, with the major design goal of UNIX compatibility, released as open source. • It has been designed to run efficiently and reliably on common PC hardware, but also runs on a variety of other platforms. • The core Linux operating system kernel is entirely original, but it can run much existing free UNIX software, resulting in an entire UNIX- compatible operating system free from proprietary code. • Linux system has many, varying Linux distributions including the kernel, applications, and management tools
  • 48. Linux 2.0 • Released in June 1996, 2.0 added two major new capabilities: – Support for multiple and multiprocessor architectures. – Improved memory-management code. – Improved TCP/IP performance – Standardized configuration interface. • Available for Motorola 68000-series processors, Sun Sparc systems, and for PC and PowerMac systems. • 2.4 and 2.6 increased SMP support, added journaling file system, preemptive kernel, 64-bit memory support. • 3.0 released in 2011, 20th anniversary of Linux, improved virtualization support, improved memory management.
  • 49. Linux Distributions • Standard, precompiled sets of packages, or distributions, include the basic Linux system, system installation and management utilities, and ready-to-install packages of common UNIX tools. • The first distributions managed these packages by simply providing a means of unpacking all the files into the appropriate places; modern distributions include advanced package management. • Early distributions included SLS and Slackware – Red Hat and Debian are popular distributions from commercial and noncommercial sources, respectively, others include Canonical and SuSE. • The RPM Package file format permits compatibility among the
  • 50. Design Principles • Linux is a multiuser, multitasking system with a full set of UNIX- compatible tools. • Its file system adheres to traditional UNIX semantics, and it fully implements the standard UNIX networking model. • Main design goals are speed, efficiency, and standardization. • Linux is designed to be compliant with the relevant POSIX documents; at least two Linux distributions have achieved official POSIX certification. – Supports Pthreads and a subset of POSIX real-time process control. • The Linux programming interface adheres to the SVR4 UNIX semantics, rather than to BSD behavior
  • 51. Components of a Linux System
  • 52. Components of a Linux System Like most UNIX implementations, Linux is composed of three main bodies of code; the most important distinction between the kernel and all other components. The kernel is responsible for maintaining the important abstractions of the operating system. Kernel code executes in kernel mode with full access to all the physical resources of the computer. All kernel code and data structures are kept in the same single address space.
  • 53. Components of a Linux System (Cont.) • The system libraries define a standard set of functions through which applications interact with the kernel, and which implement much of the operating-system functionality that does not need the full privileges of kernel code. • The system utilities perform individual specialized management tasks. • User-mode programs rich and varied, including multiple shells like the bourne-again (bash)
  • 54. Process Management • UNIX process management separates the creation of processes and the running of a new program into two distinct operations. – The fork() system call creates a new process – A new program is run after a call to exec(). • Under UNIX, a process encompasses all the information that the operating system must maintain to track the context of a single execution of a single program. • Under Linux, process properties fall into three groups: the process’s identity, environment, and context
  • 55. Process Identity • Process ID (PID) - The unique identifier for the process; used to specify processes to the operating system when an application makes a system call to signal, modify, or wait for another process. • Credentials - Each process must have an associated user ID and one or more group IDs that determine the process’s rights to access system resources and files. • Personality - Not traditionally found on UNIX systems, but under Linux each process has an associated personality identifier that can slightly modify the semantics of certain system calls. – Used primarily by emulation libraries to request that system calls be compatible with certain specific flavors of UNIX. • Namespace – Specific view of file system hierarchy – Most processes share common namespace and operate on a shared file-system hierarchy. – But each can have unique file-system hierarchy with its own root directory and set of mounted file systems.
  • 56. Process Environment • The process’s environment is inherited from its parent, and is composed of two null-terminated vectors: – The argument vector lists the command-line arguments used to invoke the running program; conventionally starts with the name of the program itself. – The environment vector is a list of “NAME=VALUE” pairs that associates named environment variables with arbitrary textual values. • Passing environment variables among processes and inheriting variables by a process’s children are flexible means of passing information to components of the user-mode system software. • The environment-variable mechanism provides a customization of the operating system that can be set on a per-process basis, rather than being configured for the system as a whole.
  • 57. Process Context • The (constantly changing) state of a running program at any point in time. • The scheduling context is the most important part of the process context; it is the information that the scheduler needs to suspend and restart the process. • The kernel maintains accounting information about the resources currently being consumed by each process, and the total resources consumed by the process in its lifetime so far. • The file table is an array of pointers to kernel file structures – When making file I/O system calls, processes refer to files by their index into this table, the file descriptor (fd)
  • 58. Process Context (Cont.) • Whereas the file table lists the existing open files, the file-system context applies to requests to open new files – The current root and default directories to be used for new file searches are stored here. • The signal-handler table defines the routine in the process’s address space to be called when specific signals arrives. • The virtual-memory context of a process describes the full contents of the its private address space
  • 59. Kernel Modules • Sections of kernel code that can be compiled, loaded, and unloaded independent of the rest of the kernel. • A kernel module may typically implement a device driver, a file system, or a networking protocol. • The module interface allows third parties to write and distribute, on their own terms, device drivers or file systems that could not be distributed under the GPL. • Kernel modules allow a Linux system to be set up with a standard, minimal kernel, without any extra device drivers built in.
  • 60. Module Management • Four components to Linux module support: – module-management system – module loader and unloader – driver-registration system – conflict-resolution mechanism • Supports loading modules into memory and letting them talk to the rest of the kernel. • Module loading is split into two separate sections: – Managing sections of module code in kernel memory – Handling symbols that modules are allowed to reference • The module requestor manages loading requested, but currently unloaded, modules; it also regularly queries the kernel to see whether a dynamically loaded module is still in use, and will unload it when it is no longer actively needed.
  • 61. Driver Registration • Allows modules to tell the rest of the kernel that a new driver has become available. • The kernel maintains dynamic tables of all known drivers, and provides a set of routines to allow drivers to be added to or removed from these tables at any time. • Registration tables include the following items: – Device drivers – File systems – Network protocols – Binary format
  • 62. Conflict Resolution • A mechanism that allows different device drivers to reserve hardware resources and to protect those resources from accidental use by another driver. • The conflict resolution module aims to: – Prevent modules from clashing over access to hardware resources – Prevent autoprobes from interfering with existing device drivers – Resolve conflicts with multiple drivers trying to access the same hardware: 1. Kernel maintains list of allocated HW resources 2. Driver reserves resources with kernel database first 3. Reservation request rejected if resource not available
  • 63. Process Management • UNIX process management separates the creation of processes and the running of a new program into two distinct operations. – The fork() system call creates a new process – A new program is run after a call to exec() • Under UNIX, a process encompasses all the information that the operating system must maintain to track the context of a single execution of a single program • Under Linux, process properties fall into three groups: the process’s identity, environment, and context
  • 64. Process Identity • Process ID (PID) - The unique identifier for the process; used to specify processes to the operating system when an application makes a system call to signal, modify, or wait for another process • Credentials - Each process must have an associated user ID and one or more group IDs that determine the process’s rights to access system resources and files • Personality - Not traditionally found on UNIX systems, but under Linux each process has an associated personality identifier that can slightly modify the semantics of certain system calls – Used primarily by emulation libraries to request that system calls be compatible with certain specific flavors of UNIX • Namespace – Specific view of file system hierarchy – Most processes share common namespace and operate on a shared file-system hierarchy – But each can have unique file-system hierarchy with its own root directory and set of mounted file systems
  • 65. Process Environment • The process’s environment is inherited from its parent, and is composed of two null-terminated vectors: – The argument vector lists the command-line arguments used to invoke the running program; conventionally starts with the name of the program itself. – The environment vector is a list of “NAME=VALUE” pairs that associates named environment variables with arbitrary textual values. • Passing environment variables among processes and inheriting variables by a process’s children are flexible means of passing information to components of the user- mode system software. • The environment-variable mechanism provides a customization of the operating system that can be set on a per-process basis, rather than being configured for the system as a whole.
  • 66. Process Context • The (constantly changing) state of a running program at any point in time • The scheduling context is the most important part of the process context; it is the information that the scheduler needs to suspend and restart the process • The kernel maintains accounting information about the resources currently being consumed by each process, and the total resources consumed by the process in its lifetime so far • The file table is an array of pointers to kernel file structures – When making file I/O system calls, processes refer to files by their index into this table, the file descriptor (fd)
  • 67. Process Context (Cont.) • Whereas the file table lists the existing open files, the file-system context applies to requests to open new files – The current root and default directories to be used for new file searches are stored here • The signal-handler table defines the routine in the process’s address space to be called when specific signals arrive • The virtual-memory context of a process describes the full contents of the its private address space