SlideShare uma empresa Scribd logo
1 de 58
POS - File System & Deadlocks
Presenter Rohit Jain
File System
• It is the way in which files are named and where they are placed logically for
storage and retrieval.
• A file system is used to control how information is stored and retrieved.
• Without file system, information placed in a storage area would be one large body
of information with no way to tell where one piece of information stops and the
next begins.
• A file system defines the structures and the rules used to read, write and maintain
information stored on a disk.
Aspects of File system
• Space management
• Filename
• Directories
• Metadata
• Restricting and permitting access
Space Management
• The File system is responsible for organizing files and directories and keeping
track of which areas of the media belongs to which file and which are not being
used.
• Slack Space
• File system fragmentation occurs when unused space or single files are not
contiguous. As file are deleted the space they were allocated eventually is
considered available for use by other files.This created alternating used and
unused areas of various sizes.
File Names
• A filename is used to identify a storage location In the file system. Most file
system have restrictions on the length of filenames. In some file system filenames
are case sensitive.
Directories
• File system typically have directories (folders) which allow user to group files into
separate collection.
• Directory structure may be linear or allow hierarchies where directory may contain
sub directory.
Metadata
• Meta Data is data about data and in filesystem it is associated as bookkeeping
information is typically associated with each file within a file system.The length of
the data contained in a file may be stored as the number of blocks allocated for
the file or as the byte count.
Restricting and Permitting access
• There are several mechanisms used by file system to control access to data.
Usually the intent is to prevent reading or modifying files by user or group of users.
Another reason is to ensure data is modified in a controlled way so access may be
restricted to a specific program.
• For Example Includes Password stored in the metadata of the file.
Types of File System
• Disk File system
• Flash File system
• Database file system
• Network file system
• Special file system
Disk file system
• A disk file system takes advantages of the ability of disk storage media to
randomly address data in a short amount of time.
• Additionally Consideration include the speed of accessing data following that
initially requested and the anticipation that the following data may be requested.
• For example ext3, NTFS, UDF etc.
Flash file system
• A flash file system considers the special abilities, performance restrictions of flash
memory devices.
• Frequently a disk file system can use a flash memory device as the underlying
storage media but it is much better to use a file system that is Specifically
designed for a flash device.
Database File system
• In this file are identified be their characteristics, like type, author or any other Rich
metadata instead of hierarchical structured management..
• IBM DB2 is a database file system.
Network File system
• A network file system is a file system that acts as a client for a remote file access
protocol, providing access to files on a server.
• For example AFS, FTP,WebDAV.
Shared Disk File system
• A shared disk file system is one in which a number of machine all have access to
the same external disk subsystem.
• The file system arbitrates access to that subsystem, Preventing write collisions.
• For example GFS 2 , GPFS etc.
Special File system
• A special File system presents non-file elements of an OS as files so they can be
acted on using system APIs.This is most commonly done in Unix Like Operating
System but devices are given file names in some non-unix-like Operating systems
as well.
File Attributes
• Name
• Type
• Protection
• Location
• Size
File Operations
• Creata :- Find spaces on disk and make entyr in directory
• Write : wirte to file requires positioning with ithe file
• Read : read from file involves positioning within the file
• Delete :- Delete Directory enry, redaim disk space
• Reposition Move read / write position.
Files access Methods
• Sequential :- readNext, writenext, Reset
• Direct :- readRecord N,WirteRecord N PostoionAt N, reset
• Indexed :- readRecord Key,Write Record Key , PositionAt Key, reset
File AllocationTable
• Where the OS record s how the disk spece is used,
• Location of FAT near the beginning og the volume
• Locatoin of FAT is specified in the boot sector
FATTypes
• FAT12 :-The earliest version the file system, FAT12 allow a partition to containg up
to 4096MB/ (212) clusters
• FAT16 :- oldest, created for DOS, supported by most OS’s cannot be installed on
partitions laeger than 2 GB, or on hard dreives larger than 4 GB
• FAT32 :- Supports disk from 512MB to 2TB, compatible with windows98 upto
latest.
NTFS
• NewTechnology File System
• Better File Security ( Encryption File system)
• Disk Compressoin – can compress a file/ folder
• NTFS volmes can not be accessed by DOS
Operating System FAT16 FAT32 NTFS
Windows XP
Windows 2000
Windows NT
Windows 95, 98, ME
Windows 95
MS-DOS
Formatting Process
• Full Format
• Quick Format
Disk Scheduling
• The OS is responsible for using hardware efficiently for the disk drives
• Access time
Total access time = seek time + rotational delay + data transfer time
Seek time – time required to move the disk arm to the required track
Rotational delay – time required to rotate the disk to the required sector
Data transfer time – time to read/write data from/to the disk
• Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for
service and the completion of last transfer.
• OS maintains queue of request, per disk or device.
Disk SchedulingAlgorithms
SeveralAlgorithms exist to schedule the servicing of disk I/O requests.
• FCFS
• SSTF
• SCAN
• C-Scan
• Look
• C-Look
Queue = 98, 183, 37, 122, 14, 124, 65, 67
Head starts at 53
First Come First Serve
• Handle I/o request Sequentially
• Fair at all Processes
• Approaches reandom scheduling in performance scheduling in performance if
there are many processes/ request.
Shortest SeekTime First
• Selects the request with the minimum seek time from the current head position.
• SSSTF scheduling is a form of SJF scheduling may cause starvation of some
requests.
SCAN
• The disk arm starts at one end of the disk , and moves toward the other end,
servicing requests until it get to the other end of the disk, where the head
movement is reversed and servicing continues.
• It moves in both directions until both ends
• Tends to stay more at the ends so more fair to the extreme cylinder requests
C-SCAN
• The head moves from one end of the disk to the other, servicing requests
as it goes.When it reaches the other end, however, it immediately returns
to the beginning of the disk, without servicing any requests on the return
trip.
• Treats the cylinders as a circular list that wraps around from the last
cylinder to the first one.
• Provides a more uniform wait time than SCAN; it treats all cylinders in
the same manner.
C- Look
• Look version of C-Scan.
• Arm only goes as far as the last request in each direction, then reverses
direction immediately, without first going all the way to the end of the
disk.
• In general, Circular versions are more fair but pay with a larger total seek
time.
• Scan versions have a larger total seek time than the corresponding Look
versions.
Selecting a Disk SchedulingAlgorithm
• Performance depends on the number and types of requests.
• Requests for disk service can be influenced by the file-allocation method.
• The disk-scheduling algorithm should be written as a separate module
of the operating system, allowing it to be replaced with a different
algorithm if necessary.
• With low load on the disk, It’s FCFS anyway. SSTF is common and has a
natural appeal – good for medium disk load.
• SCAN and C-SCAN perform better for systems that place a heavy load
on the disk; Less starvation.
• Either SSTF or LOOK is a reasonable choice for the default algorithm.
Dead Lock
• Deadlock: processes waiting indefinitely
with no chance of making progress.
• Starvation: a process waits for a long time
to make progress.
Deadlocks
• Deadlock applications not just OS
– Network
• Two processes may be blocking a send message
to the other process if they are both waiting for a
message from the other process
» Receive/waiting blocks writing
– Databases.
– Spooling/streaming data.
Deadlock Characterization
• Mutual exclusion: Only one process at a time can use a resource.
• Hold and wait: A process holding at least one resource is waiting to
acquire additional resources held by other processes.
• No preemption: A resource can be released only voluntarily by the
process holding it, after that process has completed its task.
• Circular wait: there exists a set {P0, P1, …, P0} of waiting
processes such that P0 is waiting for a resource that is held by P1,
P1 is waiting for a resource that is held by
P2, …, Pn–1 is waiting for a resource that is held by
Pn, and P0 is waiting for a resource that is held by P0.
Resource-Allocation Graph
• V is partitioned into two types:
– P = {P1, P2, …, Pn}, the set consisting of all
the processes in the system.
– R = {R1, R2, …, Rm}, the set consisting of
all resource types in the system.
request edge – directed edge P1  Rj
assignment edge – directed edge Rj 
Pi
•
•
A set of vertices V and a set of edges E.
Resource-Allocation Graph
• Process
• Resource Type with 4 instances
• Pi requests instance of
Rj
• Pi is holding an instance of
Rj
Pi
Rj
Pi
Rj
Example of a Resource Allocation
Graph
Resource Allocation Graph With A
Deadlock
Basic Facts
• If graph contains no cycles  no deadlock.
• If graph contains a cycle 
– if only one instance per resource type,
then deadlock.
– if several instances per resource type, possibility
of
deadlock.
Methods for Handling Deadlocks
• Ensure that the system will never enter
a deadlock state.
• Allow the system to enter a deadlock state
and
then recover.
• Ignore the problem and pretend that
deadlocks never occur in the system; used by
most operating systems, including UNIX.
Deadlock Prevention
• Mutual Exclusion – not required for sharable
resources; must hold for nonsharable
resources.
• Hold and Wait – must guarantee that whenever
a process requests a resource, it does not hold
any other resources.
– Require process to request and be allocated all its
resources before it begins execution, or allow process
to request resources only when the process has none.
– Low resource utilization; starvation possible.
Deadlock Prevention
• No Preemption –
– If a process that is holding some resources requests
another resource that cannot be immediately allocated to
it, then all resources currently being held are released.
– Preempted resources are added to the list of resources
for which the process is waiting.
– Process will be restarted only when it can regain its old
resources, as well as the new ones that it is requesting.
• Circular Wait – impose a total ordering of all
resource types, and require that each
process requests resources in an increasing
order of enumeration.
Deadlock Avoidance
• Simplest and most useful model requires that each process
declare the maximum number of resources of each type
that it may need.
• The deadlock-avoidance algorithm dynamically examines
the resource-allocation state to ensure that there can
never be a circular-wait condition.
• Resource-allocation state is defined by the number of
available and allocated resources, and the maximum
demands of the processes.
Requires that the system has some additional a priori
information available.
Banker’s Algorithm
Multiple instances
Each process must a priori claim of the maximum use.
When a process requests a resource it may have to wait.
When a process gets all its resources, it must return them in a
finite amount of time.
Data Structures for Banker’s Algorithm
n = number of processes, and m = number of resources types
Available: vector of length m.
• If Available[j ] = k, there are k instances of resource type Rj
available.
Max: n × m matrix.
• If Max[i , j ] = k, then process Pi may request at most k instances of
resource type Rj .
Allocation: n × m matrix.
• If Allocation[i , j ] = k then Pi is currently allocated k instances of
Rj .
Need: n × m matrix.
• If Need[i , j ] = k, then Pi may need k more instances of Rj to
complete its task Need[i , j ] = Max[i , j ] − Allocation[i , j ]
Resource-Request Algorithm for Process Pi
Requesti= request vector for process Pi . If Requesti [j ] = k, then
process Pi wants k instances of resource type Rj .
1. If Requesti ≤ Needi , go to step 2. Otherwise, raise error
condition, since process has exceeded its maximum claim.
2. If Requesti ≤ Available, go to step 3. Otherwise Pimust wait, since
resources are not available.
Resource-Request Algorithm for Process Pi
• If safe: the resources are allocated to Pi
• If unsafe: Pi must wait, and the old resource-allocation state is restored
3. Pretend to allocate requested resources to Pi
state as follows:
Available = Available − Requesti
Allocationi = Allocationi + Requesti Needi = Needi
− Requesti
Banker’s Algorithm Example
5 processes: P0 through P4
3 resource types:
• A (10 instances), B (5 instances), and C (7
instances)
Snapshot at time
T0
Banker’s Algorithm Example
(2/2)
The content of the matrix Need is defined to be Max −
Allocation
Is the system safe? (P1, P3, P4, P2, P0) satisfies safety
criteria.
Deadlock Detection
Allow system to enter deadlock state
Detection algorithm
Recovery scheme
Single Instance of Each Resource Type
Maintain wait-for graph.
• Nodes are processes.
• Pi → Pj if Pi is waiting for Pj
.
Periodically invoke an algorithm that searches for a cycle in
the graph.
If there is a cycle, there exists a
deadlock.
An algorithm to detect a cycle in a graph requires an
O(n2)
operations, where n is the number of vertices in the
graph.
Resource-Allocation Graph and Wait-for
Graph
Resource-al ocation
graph
Corresponding Wait-for
graph
Recovery from Deadlock
Process termination
Resource preemption
Process Termination
Abort all deadlocked processes.
Abort one process at a time until the deadlock cycle is eliminated
In which order should we choose to abort?
Priority of the process.
How long process has computed, and how much longer to completion.
Resources the process has used. Resources process
needs to complete.
How many processes will need to be terminated. Is process
interactive or batch.
Resource Preemption
Selecting a victim: minimize cost
Rollback: return to some safe state, restart process for that state.
Starvation: same process may always be picked as victim, include
number of rollback in cost factor.
Summary
Four simultaneous conditions: mutual exclusion, hold and wait, no preemption,
circular wait
Deadlock prevention:
Deadlock avoidance: resource-allocation algorithm, banker’s algo- rithm
Deadlock detection: Wait-for graph
Deadlock recovery: process termination, resource preemption
POS - File Systems & Deadlocks Prevention

Mais conteúdo relacionado

Mais procurados (20)

Ethernet and token ring
Ethernet and token ringEthernet and token ring
Ethernet and token ring
 
DATA RATE LIMITS
DATA RATE LIMITSDATA RATE LIMITS
DATA RATE LIMITS
 
Icmp
IcmpIcmp
Icmp
 
Issues in Data Link Layer
Issues in Data Link LayerIssues in Data Link Layer
Issues in Data Link Layer
 
EIGRP Overview
EIGRP OverviewEIGRP Overview
EIGRP Overview
 
Telnet & SSH
Telnet & SSHTelnet & SSH
Telnet & SSH
 
Stop and-wait protocol
Stop and-wait protocolStop and-wait protocol
Stop and-wait protocol
 
2.8 bluetooth ieee 802.15
2.8 bluetooth   ieee 802.152.8 bluetooth   ieee 802.15
2.8 bluetooth ieee 802.15
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake
 
OSI layer by cisco
OSI layer by ciscoOSI layer by cisco
OSI layer by cisco
 
Networking devices
Networking devicesNetworking devices
Networking devices
 
Unit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systemsUnit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systems
 
Data Link Layer Numericals
Data Link Layer NumericalsData Link Layer Numericals
Data Link Layer Numericals
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Dhcp
DhcpDhcp
Dhcp
 
The Osi Model
The Osi ModelThe Osi Model
The Osi Model
 
PPP (Point to Point Protocol)
PPP (Point to Point Protocol)PPP (Point to Point Protocol)
PPP (Point to Point Protocol)
 
CCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
CCNAv5 - S1: Chapter 9 - Subnetting Ip NetworksCCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
CCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
 
Chapter 7 multiple access techniques
Chapter 7 multiple access techniquesChapter 7 multiple access techniques
Chapter 7 multiple access techniques
 
E mail protocol - SMTP
E mail protocol - SMTPE mail protocol - SMTP
E mail protocol - SMTP
 

Semelhante a POS - File Systems & Deadlocks Prevention

File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control YuvrajWadavale
 
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxUNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxLeahRachael
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Ahmed El-Arabawy
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Ahmed El-Arabawy
 
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.pdfJESUNPK
 
Introduction to distributed file systems
Introduction to distributed file systemsIntroduction to distributed file systems
Introduction to distributed file systemsViet-Trung TRAN
 
UNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxUNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxNavyaKumar22
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemSneh Prabha
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & ApplicationsMaulen Bale
 

Semelhante a POS - File Systems & Deadlocks Prevention (20)

File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 
Ch10 file system interface
Ch10   file system interfaceCh10   file system interface
Ch10 file system interface
 
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxUNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
 
Os
OsOs
Os
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
 
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
 
Introduction to distributed file systems
Introduction to distributed file systemsIntroduction to distributed file systems
Introduction to distributed file systems
 
UNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxUNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptx
 
Os7
Os7Os7
Os7
 
9781111306366 ppt ch11
9781111306366 ppt ch119781111306366 ppt ch11
9781111306366 ppt ch11
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
 
OS Unit5.pptx
OS Unit5.pptxOS Unit5.pptx
OS Unit5.pptx
 
FAT.pptx
FAT.pptxFAT.pptx
FAT.pptx
 
Thiru
ThiruThiru
Thiru
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Unit 4 DBMS.ppt
Unit 4 DBMS.pptUnit 4 DBMS.ppt
Unit 4 DBMS.ppt
 
Unix File System
Unix File SystemUnix File System
Unix File System
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
 
OS UNIT4.pptx
OS UNIT4.pptxOS UNIT4.pptx
OS UNIT4.pptx
 

Mais de Rohit Jain

VR - Virtual reality
VR - Virtual realityVR - Virtual reality
VR - Virtual realityRohit Jain
 
Lifi - Light Fidelity
Lifi - Light FidelityLifi - Light Fidelity
Lifi - Light FidelityRohit Jain
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligenceRohit Jain
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsRohit Jain
 
Introduction about Processors
Introduction about Processors Introduction about Processors
Introduction about Processors Rohit Jain
 
Overview On water
Overview On waterOverview On water
Overview On waterRohit Jain
 
Advance peripheral devices
Advance peripheral devicesAdvance peripheral devices
Advance peripheral devicesRohit Jain
 

Mais de Rohit Jain (9)

VR - Virtual reality
VR - Virtual realityVR - Virtual reality
VR - Virtual reality
 
Social media
Social mediaSocial media
Social media
 
Lifi - Light Fidelity
Lifi - Light FidelityLifi - Light Fidelity
Lifi - Light Fidelity
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
Sutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithmsSutherlands Cohen and Hodgeman algorithms
Sutherlands Cohen and Hodgeman algorithms
 
Introduction about Processors
Introduction about Processors Introduction about Processors
Introduction about Processors
 
Overview On water
Overview On waterOverview On water
Overview On water
 
Advance peripheral devices
Advance peripheral devicesAdvance peripheral devices
Advance peripheral devices
 
Big Data
Big DataBig Data
Big Data
 

Último

DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdfAkritiPradhan2
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmDeepika Walanjkar
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 

Último (20)

DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 

POS - File Systems & Deadlocks Prevention

  • 1. POS - File System & Deadlocks Presenter Rohit Jain
  • 2. File System • It is the way in which files are named and where they are placed logically for storage and retrieval. • A file system is used to control how information is stored and retrieved. • Without file system, information placed in a storage area would be one large body of information with no way to tell where one piece of information stops and the next begins. • A file system defines the structures and the rules used to read, write and maintain information stored on a disk.
  • 3. Aspects of File system • Space management • Filename • Directories • Metadata • Restricting and permitting access
  • 4. Space Management • The File system is responsible for organizing files and directories and keeping track of which areas of the media belongs to which file and which are not being used. • Slack Space • File system fragmentation occurs when unused space or single files are not contiguous. As file are deleted the space they were allocated eventually is considered available for use by other files.This created alternating used and unused areas of various sizes.
  • 5. File Names • A filename is used to identify a storage location In the file system. Most file system have restrictions on the length of filenames. In some file system filenames are case sensitive.
  • 6. Directories • File system typically have directories (folders) which allow user to group files into separate collection. • Directory structure may be linear or allow hierarchies where directory may contain sub directory.
  • 7. Metadata • Meta Data is data about data and in filesystem it is associated as bookkeeping information is typically associated with each file within a file system.The length of the data contained in a file may be stored as the number of blocks allocated for the file or as the byte count.
  • 8. Restricting and Permitting access • There are several mechanisms used by file system to control access to data. Usually the intent is to prevent reading or modifying files by user or group of users. Another reason is to ensure data is modified in a controlled way so access may be restricted to a specific program. • For Example Includes Password stored in the metadata of the file.
  • 9. Types of File System • Disk File system • Flash File system • Database file system • Network file system • Special file system
  • 10. Disk file system • A disk file system takes advantages of the ability of disk storage media to randomly address data in a short amount of time. • Additionally Consideration include the speed of accessing data following that initially requested and the anticipation that the following data may be requested. • For example ext3, NTFS, UDF etc.
  • 11. Flash file system • A flash file system considers the special abilities, performance restrictions of flash memory devices. • Frequently a disk file system can use a flash memory device as the underlying storage media but it is much better to use a file system that is Specifically designed for a flash device.
  • 12. Database File system • In this file are identified be their characteristics, like type, author or any other Rich metadata instead of hierarchical structured management.. • IBM DB2 is a database file system.
  • 13. Network File system • A network file system is a file system that acts as a client for a remote file access protocol, providing access to files on a server. • For example AFS, FTP,WebDAV.
  • 14. Shared Disk File system • A shared disk file system is one in which a number of machine all have access to the same external disk subsystem. • The file system arbitrates access to that subsystem, Preventing write collisions. • For example GFS 2 , GPFS etc.
  • 15. Special File system • A special File system presents non-file elements of an OS as files so they can be acted on using system APIs.This is most commonly done in Unix Like Operating System but devices are given file names in some non-unix-like Operating systems as well.
  • 16. File Attributes • Name • Type • Protection • Location • Size
  • 17. File Operations • Creata :- Find spaces on disk and make entyr in directory • Write : wirte to file requires positioning with ithe file • Read : read from file involves positioning within the file • Delete :- Delete Directory enry, redaim disk space • Reposition Move read / write position.
  • 18. Files access Methods • Sequential :- readNext, writenext, Reset • Direct :- readRecord N,WirteRecord N PostoionAt N, reset • Indexed :- readRecord Key,Write Record Key , PositionAt Key, reset
  • 19. File AllocationTable • Where the OS record s how the disk spece is used, • Location of FAT near the beginning og the volume • Locatoin of FAT is specified in the boot sector
  • 20. FATTypes • FAT12 :-The earliest version the file system, FAT12 allow a partition to containg up to 4096MB/ (212) clusters • FAT16 :- oldest, created for DOS, supported by most OS’s cannot be installed on partitions laeger than 2 GB, or on hard dreives larger than 4 GB • FAT32 :- Supports disk from 512MB to 2TB, compatible with windows98 upto latest.
  • 21. NTFS • NewTechnology File System • Better File Security ( Encryption File system) • Disk Compressoin – can compress a file/ folder • NTFS volmes can not be accessed by DOS
  • 22. Operating System FAT16 FAT32 NTFS Windows XP Windows 2000 Windows NT Windows 95, 98, ME Windows 95 MS-DOS
  • 23. Formatting Process • Full Format • Quick Format
  • 24. Disk Scheduling • The OS is responsible for using hardware efficiently for the disk drives • Access time Total access time = seek time + rotational delay + data transfer time Seek time – time required to move the disk arm to the required track Rotational delay – time required to rotate the disk to the required sector Data transfer time – time to read/write data from/to the disk • Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of last transfer. • OS maintains queue of request, per disk or device.
  • 25. Disk SchedulingAlgorithms SeveralAlgorithms exist to schedule the servicing of disk I/O requests. • FCFS • SSTF • SCAN • C-Scan • Look • C-Look Queue = 98, 183, 37, 122, 14, 124, 65, 67 Head starts at 53
  • 26. First Come First Serve • Handle I/o request Sequentially • Fair at all Processes • Approaches reandom scheduling in performance scheduling in performance if there are many processes/ request.
  • 27. Shortest SeekTime First • Selects the request with the minimum seek time from the current head position. • SSSTF scheduling is a form of SJF scheduling may cause starvation of some requests.
  • 28. SCAN • The disk arm starts at one end of the disk , and moves toward the other end, servicing requests until it get to the other end of the disk, where the head movement is reversed and servicing continues. • It moves in both directions until both ends • Tends to stay more at the ends so more fair to the extreme cylinder requests
  • 29. C-SCAN • The head moves from one end of the disk to the other, servicing requests as it goes.When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip. • Treats the cylinders as a circular list that wraps around from the last cylinder to the first one. • Provides a more uniform wait time than SCAN; it treats all cylinders in the same manner.
  • 30. C- Look • Look version of C-Scan. • Arm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk. • In general, Circular versions are more fair but pay with a larger total seek time. • Scan versions have a larger total seek time than the corresponding Look versions.
  • 31. Selecting a Disk SchedulingAlgorithm • Performance depends on the number and types of requests. • Requests for disk service can be influenced by the file-allocation method. • The disk-scheduling algorithm should be written as a separate module of the operating system, allowing it to be replaced with a different algorithm if necessary. • With low load on the disk, It’s FCFS anyway. SSTF is common and has a natural appeal – good for medium disk load.
  • 32. • SCAN and C-SCAN perform better for systems that place a heavy load on the disk; Less starvation. • Either SSTF or LOOK is a reasonable choice for the default algorithm.
  • 33. Dead Lock • Deadlock: processes waiting indefinitely with no chance of making progress. • Starvation: a process waits for a long time to make progress.
  • 34. Deadlocks • Deadlock applications not just OS – Network • Two processes may be blocking a send message to the other process if they are both waiting for a message from the other process » Receive/waiting blocks writing – Databases. – Spooling/streaming data.
  • 35. Deadlock Characterization • Mutual exclusion: Only one process at a time can use a resource. • Hold and wait: A process holding at least one resource is waiting to acquire additional resources held by other processes. • No preemption: A resource can be released only voluntarily by the process holding it, after that process has completed its task. • Circular wait: there exists a set {P0, P1, …, P0} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and P0 is waiting for a resource that is held by P0.
  • 36. Resource-Allocation Graph • V is partitioned into two types: – P = {P1, P2, …, Pn}, the set consisting of all the processes in the system. – R = {R1, R2, …, Rm}, the set consisting of all resource types in the system. request edge – directed edge P1  Rj assignment edge – directed edge Rj  Pi • • A set of vertices V and a set of edges E.
  • 37. Resource-Allocation Graph • Process • Resource Type with 4 instances • Pi requests instance of Rj • Pi is holding an instance of Rj Pi Rj Pi Rj
  • 38. Example of a Resource Allocation Graph
  • 39. Resource Allocation Graph With A Deadlock
  • 40. Basic Facts • If graph contains no cycles  no deadlock. • If graph contains a cycle  – if only one instance per resource type, then deadlock. – if several instances per resource type, possibility of deadlock.
  • 41. Methods for Handling Deadlocks • Ensure that the system will never enter a deadlock state. • Allow the system to enter a deadlock state and then recover. • Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX.
  • 42. Deadlock Prevention • Mutual Exclusion – not required for sharable resources; must hold for nonsharable resources. • Hold and Wait – must guarantee that whenever a process requests a resource, it does not hold any other resources. – Require process to request and be allocated all its resources before it begins execution, or allow process to request resources only when the process has none. – Low resource utilization; starvation possible.
  • 43. Deadlock Prevention • No Preemption – – If a process that is holding some resources requests another resource that cannot be immediately allocated to it, then all resources currently being held are released. – Preempted resources are added to the list of resources for which the process is waiting. – Process will be restarted only when it can regain its old resources, as well as the new ones that it is requesting. • Circular Wait – impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration.
  • 44. Deadlock Avoidance • Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need. • The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. • Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. Requires that the system has some additional a priori information available.
  • 45. Banker’s Algorithm Multiple instances Each process must a priori claim of the maximum use. When a process requests a resource it may have to wait. When a process gets all its resources, it must return them in a finite amount of time.
  • 46. Data Structures for Banker’s Algorithm n = number of processes, and m = number of resources types Available: vector of length m. • If Available[j ] = k, there are k instances of resource type Rj available. Max: n × m matrix. • If Max[i , j ] = k, then process Pi may request at most k instances of resource type Rj . Allocation: n × m matrix. • If Allocation[i , j ] = k then Pi is currently allocated k instances of Rj . Need: n × m matrix. • If Need[i , j ] = k, then Pi may need k more instances of Rj to complete its task Need[i , j ] = Max[i , j ] − Allocation[i , j ]
  • 47. Resource-Request Algorithm for Process Pi Requesti= request vector for process Pi . If Requesti [j ] = k, then process Pi wants k instances of resource type Rj . 1. If Requesti ≤ Needi , go to step 2. Otherwise, raise error condition, since process has exceeded its maximum claim. 2. If Requesti ≤ Available, go to step 3. Otherwise Pimust wait, since resources are not available.
  • 48. Resource-Request Algorithm for Process Pi • If safe: the resources are allocated to Pi • If unsafe: Pi must wait, and the old resource-allocation state is restored 3. Pretend to allocate requested resources to Pi state as follows: Available = Available − Requesti Allocationi = Allocationi + Requesti Needi = Needi − Requesti
  • 49. Banker’s Algorithm Example 5 processes: P0 through P4 3 resource types: • A (10 instances), B (5 instances), and C (7 instances) Snapshot at time T0
  • 50. Banker’s Algorithm Example (2/2) The content of the matrix Need is defined to be Max − Allocation Is the system safe? (P1, P3, P4, P2, P0) satisfies safety criteria.
  • 51. Deadlock Detection Allow system to enter deadlock state Detection algorithm Recovery scheme
  • 52. Single Instance of Each Resource Type Maintain wait-for graph. • Nodes are processes. • Pi → Pj if Pi is waiting for Pj . Periodically invoke an algorithm that searches for a cycle in the graph. If there is a cycle, there exists a deadlock. An algorithm to detect a cycle in a graph requires an O(n2) operations, where n is the number of vertices in the graph.
  • 53. Resource-Allocation Graph and Wait-for Graph Resource-al ocation graph Corresponding Wait-for graph
  • 54. Recovery from Deadlock Process termination Resource preemption
  • 55. Process Termination Abort all deadlocked processes. Abort one process at a time until the deadlock cycle is eliminated In which order should we choose to abort? Priority of the process. How long process has computed, and how much longer to completion. Resources the process has used. Resources process needs to complete. How many processes will need to be terminated. Is process interactive or batch.
  • 56. Resource Preemption Selecting a victim: minimize cost Rollback: return to some safe state, restart process for that state. Starvation: same process may always be picked as victim, include number of rollback in cost factor.
  • 57. Summary Four simultaneous conditions: mutual exclusion, hold and wait, no preemption, circular wait Deadlock prevention: Deadlock avoidance: resource-allocation algorithm, banker’s algo- rithm Deadlock detection: Wait-for graph Deadlock recovery: process termination, resource preemption

Notas do Editor

  1. By separating the information into individual pieces and giving each piece a name, the information is easily separated and identified. Taking its name from the way paper based information system are named, each piece of information is called a “file” The structure and logic rules used to manage the groups of information their names is called a “file system”. Different structure and logic, properties of speed, flexibility, security, size. Iso file system of disk Different storage devices with differene media. Hard drive is coated with magnetic film. File system are used to implement type of data store, retrieve and update. File system referse to either he abstract data structures used to define files, actual software or firmware.
  2. When a file is created and there is not an area of contiguous space available for its initial allocation the space must be assigned in fragments. When a file is modified such that it becomes larger it may exceed the space initially allocated to it, another allocation must be assigned elsewhere and the file becomes fragmented.
  3. Modern File system have wide range of chatacter.
  4. File system might store the file creation time, the time it was last modified or the last time it was backed up. Other information can include the file's device type (e.g. block, character, socket, subdirectory, etc.), its owner user ID and group ID, its access permissions and other file attributes (e.g. whether the file is read-only, executable, etc.).
  5. Methods for encrypting file data are sometimes included in the file system. This is very effective since there is no need for file system utilities to know the encryption seed to effectively manage the data.
  6. Name :- Provide Handle for reference Dos (8 char + 3 ext.), Windows ( unlimited Length) Unix ( spaces tricky, no extension needed) Type:- Indicates how the file should be treated DOS/Windows rely on extension, can map extensions to programs Mac associates creator attribute with each file (OS X?) UNIX uses "magic number", first few bytes of file specify file type For example MS-DOS Filsnames Name 1 to 8 char Extension 1 to 3 char Dos only uses uppercase without spaces and special character.
  7. Recovery features-each file operation broken down into atomic transactions. maintains a transaction log – updates disk after each transaction if failure occurs during a transaction, info is sufficient to complete or rollback if a bad sector is found when writing, will automatically map to a different sector
  8. Full Format lays down new tracks and sectors, Verifies the integrity of each sector. By doing a surface scan – OS will put dummy data into sectors and then try to read the sector Quick Format: - Remove files Does not check for defective sectors
  9. Seek time is the time for the disk are to move the heads to the cylinder containing the desired sector. Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head.