• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
File access methods.54
 

File access methods.54

on

  • 4,572 views

 

Statistics

Views

Total Views
4,572
Views on SlideShare
4,557
Embed Views
15

Actions

Likes
0
Downloads
72
Comments
1

1 Embed 15

http://raj-os.blogspot.in 15

Accessibility

Categories

Upload Details

Uploaded via

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • thanks
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    File access methods.54 File access methods.54 Presentation Transcript

    • File Concept, File Management, File 1
    • RecapIn the last class, you have learnt:• File and File operations 9CM 402.54 2
    • • HOME PREVIOUS TOPIC NEXT• PREVIOUS QUESTION PAPERS FOR OS• CPP TUTORIALS 3
    • Objective(s)On completion of this period, you would be able to:• Understand the different file access methods• Introduction to directory 9CM 402.54 4
    • Introduction• Files store information• This information must be accessed and read into computer memory for use• There are different access methods• Some systems support only one access method• Other systems support different access methods 9CM 402.54 5
    • Types of Access Methods• Sequential Access• Direct Access• Other Access Methods 9CM 402.54 6
    • Sequential Access• Simplest access method• Information processed in order• Most common• Used by editors and compilers• Based on a tape model of a file• Works well on sequential access devices and random access devices 9CM 402.54 7
    • Sequential Access current positionbeginning end rewind read or write Fig : Sequential Access File 9CM 402.54 8
    • Most Common Operations on Files• Read• Write 9CM 402.54 9
    • File Pointer• Whenever a file is opened for read or write operation a file pointer is maintained to keep track of the current position in the file 9CM 402.54 10
    • Read operation• Reads the next portion of the file• Automatically advances file pointer 9CM 402.54 11
    • Write operation• Appends data to the end of the file• Advances pointer to the new end of file 9CM 402.54 12
    • Reset• Reset to beginning 9CM 402.54 13
    • Skip• Skip n records forwards or backwards ( supported by few systems ) 9CM 402.54 14
    • Applications for sequential access• Payroll of employees• Student data processing 9CM 402.54 15
    • Direct Access• Also known as Relative Access• Fixed length logical records• No particular order for read and write• Based on disk model of a file• File viewed as a numbered sequence of blocks or records• Arbitrary block read or written 9CM 402.54 16
    • Direct Access• Useful for immediate access to large volumes of data• Most suitable for database applications• Easy to read, write and delete a record 9CM 402.54 17
    • Direct Access•Address of arbitrary record N Let length of logical record = L Address of record N = L*(N-1) 9CM 402.54 18
    • Simulate Sequential Access• Easy to simulate sequential access on direct access file• Keep a variable cp i.e. Current position 9CM 402.54 19
    • Simulate Sequential Access Sequential Access Implementation for direct access reset cp := 0 read next read cp cp := cp + 1 write next write cp cp := cp + 1Fig : Simulation of sequential access on a direct access file 9CM 402.54 20
    • Applications for Direct access• Airline reservation system• Customer account processing in a bank 9CM 402.54 21
    • Other Access Methods• Built on top of direct access method• Require the construction of an index for the file• Index is a small table stored in memory• The index contains pointers to various blocks 9CM 402.54 22
    • To find an entry in the file…• Search the index• Use the pointer to access the file directly for the desired entry 9CM 402.54 23
    • To find an entry in the file logical recordlast name number Adams Arthur Asher Smith, John SSN Age . . . Smith relative file index file 9CM 402.54 24
    • Primary index and Secondary index• With large files index file itself too large to be in memory• Solution is create index for the index file• Primary index points to secondary index• Secondary index points to actual data 9CM 402.54 25
    • Other subject materials• Web designing• Micro processors• C++ tutorials• javahome