SlideShare a Scribd company logo
1 of 29
File Management
Organization of data
       - Creating a file
       - Storing a file in required directory
       - Removing a file
       - Opening a file
       - Closing a file
       - Maintaining of file details
       - Name, Type, location, size ,
date and time of creation or modification
       - File Protection



                    http://raj-os.blogspot.in/   1
File Attributes

-   Name

-   Type

-   Location

-   Size

-   Protection

-   Time, Date and User Identification




                 http://raj-os.blogspot.in/   2
File Attributes

Name

  -    Given by the user

  -    Only information that is kept in human readable form

Type

         -   Information required by systems that support different
         types




                             http://raj-os.blogspot.in/               3
File attributes

Location

        - A pointer to a device and to the
        location of the file on that device

Size

       - Current size of file (in bytes or words )

        - Max size allowed

                         http://raj-os.blogspot.in/   4
File Attributes

Protection

      -   Access control information

          ( read, write and execute privileges )




                          http://raj-os.blogspot.in/   5
File Attributes

Time, date and user identification

      -       Creation

      -       Last modification

      -       Last use

  (Useful for protection, security and usage monitoring )




                         http://raj-os.blogspot.in/         6
Basic File Operations ( Minimal Set )

1. Creating a file

2. Repositioning within a file

3. Deleting a file

4. Truncating a file

5. Reading a file

6. Writing a file

                     http://raj-os.blogspot.in/   7
Basic File Operations


1. Creating a file


  •    Allocation of space for the file in the file system


  •    Making an entry for the new file in the directory




                          http://raj-os.blogspot.in/         8
Basic File Operations

2. Writing a file
•    Use a system call specifying
              - Name of the file

              - Information to be written

•    Search directory for the associated entry

•    Keep a write pointer

•    Update write pointer after every write

                        http://raj-os.blogspot.in/   9
Basic File Operations
3. Reading a file
•   Use a system call specifying
              - Name of the file
              - Address where to put the contents read
•   Search directory for the associated entry
•   Keep a read pointer

•   Update read pointer after every read



                          http://raj-os.blogspot.in/     10
Basic File Operations


4. Repositioning within a file

•   Also known as file seek operation

•   Search directory for the appropriate entry

•   Set current-file-position to a given value




                          http://raj-os.blogspot.in/   11
Basic File Operations


5.Deleting a file

•   Search the directory for the named file

•   Release all file space


•   Erase the directory entry




                             http://raj-os.blogspot.in/   12
Basic File Operations

6. Truncating a file

• File contents erased

• Name and attributes of file unchanged




                         http://raj-os.blogspot.in/   13
Other File Operations
• Appending
• Renaming
Appending
Add some information at the end of the file
Renaming
       Name of file changed

            All other attributes unchanged

               http://raj-os.blogspot.in/     14
Basic file operations can be combined to implement other
operations

Ex : Creating a copy of a file

- Create a new file

- Read from old file

- Write to new file




                           http://raj-os.blogspot.in/      15
Other Desirable Operations

Allow the user to get and set the various attributes of a file

Ex : i) get the file length

    ii) set file attributes like file’s owner




                         http://raj-os.blogspot.in/         16
Other Desirable Operations


Most file operations involve searching the directory for the

entry associated with the named file




                       http://raj-os.blogspot.in/         17
To Avoid Constant Searching

•   Many systems open a file when file first is used

•   The operating system keeps a small table called the

    Open file table

•   Open file table contains information about open files

•   When a file operation is requested, an index into the

    open file table is used


                              http://raj-os.blogspot.in/    18
Other File Operations

     When a file is no longer actively used, it is closed by
     the process and the O.S. removes its entry in the         Open
file table




                         http://raj-os.blogspot.in/               19
Other File Operations

• Some systems implicitly open a file when it is first referenced

• Close it automatically when the program that opened the file
  terminates




                          http://raj-os.blogspot.in/                20
Other File Operations


Most systems require that a file be opened explicitly by the

programmer with a system call ( open ) before that file can be

used




                       http://raj-os.blogspot.in/              21
File Type             Usual extension                           Function

Executable      Exe, com, bin or none                   Ready to run machine
                                                        language program
Object          obj, o                                  Compiled, machine language,
                                                        not linked

Source code     c, p, pas, f77, asm, a                  Source code in various
                                                        languages
Batch           bat, sh                                 Commands to the command
                                                        interpreter

Text            txt, doc                                textual data,documents
Word            Wp, tex, rrf etc                        Various word processor
Processor                                               formats
Library         Lib, a                                  Libraries of routines
Print or view   ps, dvi, gif                            ASCII or binary file in a
                                                        format for printing or viewing

Archive         arc, zip, tar                           Related group of files for
                                                        archiving or storage

                           Fig : Common File Types

                           http://raj-os.blogspot.in/                                    22
File Type

One major consideration in designing a file system, and the
entire operating system, is whether the operating system

should recognize and support file types




                       http://raj-os.blogspot.in/             23
File Type


•       If the operating system recognizes the type of a file
    •     it can then operate on the file in reasonable ways

    •     Ex : An attempt to print a binary-object form of a

          program file can be prevented




                            http://raj-os.blogspot.in/         24
File Type

To implement file types, include the type as part of
the file name
For Ex : letters , documents




                   http://raj-os.blogspot.in/      25
File Type


The file name is split into two parts

      -      a name

      -      an extension




                       http://raj-os.blogspot.in/   26
File Type

•   The file name is usually separated from the
    extension by a period ( dot ) character

    Ex : paycalc. cpp

•   The name can consists up to 8 characters followed
    by a period



                        http://raj-os.blogspot.in/      27
File Type
The extension tells what the file type is
• Extension can be up to 3 characters
• System uses the extension to indicate the type of the
  file
• Type of operations that can be done on that file
 For ex : .com , .exe & .bat extension are executable
  file

                       http://raj-os.blogspot.in/       28
Summary
In this class, you have learnt
- file concept
- Understand file operations
- Know various file types




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

More Related Content

What's hot

The unix file system
The unix file systemThe unix file system
The unix file systemgsandeepmenon
 
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...Syaiful Ahdan
 
The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structureTeja Bheemanapally
 
Unix files
Unix filesUnix files
Unix filesSunil Rm
 
File system structure in linux
File system structure in linuxFile system structure in linux
File system structure in linuxSukkur IBA
 
AdvFS/Advanced File System Ccncepts
AdvFS/Advanced File System CcnceptsAdvFS/Advanced File System Ccncepts
AdvFS/Advanced File System CcnceptsJustin Goldberg
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linuxZkre Saleh
 
File protection.59 to 60
File protection.59 to 60File protection.59 to 60
File protection.59 to 60myrajendra
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Vu Hung Nguyen
 
Xfs file system for linux
Xfs file system for linuxXfs file system for linux
Xfs file system for linuxAjay Sood
 

What's hot (20)

The unix file system
The unix file systemThe unix file system
The unix file system
 
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...
 
The linux file system structure
The linux file system structureThe linux file system structure
The linux file system structure
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Unix files
Unix filesUnix files
Unix files
 
File system structure in linux
File system structure in linuxFile system structure in linux
File system structure in linux
 
AdvFS/Advanced File System Ccncepts
AdvFS/Advanced File System CcnceptsAdvFS/Advanced File System Ccncepts
AdvFS/Advanced File System Ccncepts
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linux
 
File protection.59 to 60
File protection.59 to 60File protection.59 to 60
File protection.59 to 60
 
File Management
File ManagementFile Management
File Management
 
Files
FilesFiles
Files
 
Ch11 file system interface
Ch11 file system interfaceCh11 file system interface
Ch11 file system interface
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
File Management
File ManagementFile Management
File Management
 
File system
File systemFile system
File system
 
File Management
File ManagementFile Management
File Management
 
Xfs file system for linux
Xfs file system for linuxXfs file system for linux
Xfs file system for linux
 
Unix File System
Unix File SystemUnix File System
Unix File System
 
Linux files
Linux filesLinux files
Linux files
 

Viewers also liked

38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentationmyrajendra
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocationmyrajendra
 
36 fragmentaio nnd pageconcepts
36 fragmentaio nnd pageconcepts36 fragmentaio nnd pageconcepts
36 fragmentaio nnd pageconceptsmyrajendra
 
40 demand paging
40 demand paging40 demand paging
40 demand pagingmyrajendra
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43myrajendra
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memorymyrajendra
 
37 segmentation
37 segmentation37 segmentation
37 segmentationmyrajendra
 
Types of memory
Types of memoryTypes of memory
Types of memorymyrajendra
 
Types of memory 10 to11
Types of memory 10 to11Types of memory 10 to11
Types of memory 10 to11myrajendra
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1myrajendra
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56myrajendra
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44myrajendra
 
Files concepts.53
Files concepts.53Files concepts.53
Files concepts.53myrajendra
 
4 various operating systems
4 various operating systems4 various operating systems
4 various operating systemsmyrajendra
 
Operations on a directory 54(3
Operations on a directory 54(3Operations on a directory 54(3
Operations on a directory 54(3myrajendra
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49myrajendra
 
Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58myrajendra
 

Viewers also liked (20)

38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentation
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocation
 
36 fragmentaio nnd pageconcepts
36 fragmentaio nnd pageconcepts36 fragmentaio nnd pageconcepts
36 fragmentaio nnd pageconcepts
 
40 demand paging
40 demand paging40 demand paging
40 demand paging
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memory
 
37 segmentation
37 segmentation37 segmentation
37 segmentation
 
Types of memory
Types of memoryTypes of memory
Types of memory
 
Types of memory 10 to11
Types of memory 10 to11Types of memory 10 to11
Types of memory 10 to11
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Data type
Data typeData type
Data type
 
Fundamentals
FundamentalsFundamentals
Fundamentals
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44
 
Files concepts.53
Files concepts.53Files concepts.53
Files concepts.53
 
4 various operating systems
4 various operating systems4 various operating systems
4 various operating systems
 
Operations on a directory 54(3
Operations on a directory 54(3Operations on a directory 54(3
Operations on a directory 54(3
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49
 
33
3333
33
 
Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58
 

Similar to File management53(1)

File system interface
File system interfaceFile system interface
File system interfaceDayan Ahmed
 
Learn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptLearn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptgeethasenthil2706
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access methodrajshreemuthiah
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.pptHelalMirzad
 
Javase7 1641812
Javase7 1641812Javase7 1641812
Javase7 1641812Vinay H G
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control YuvrajWadavale
 
Basic linux architecture
Basic linux architectureBasic linux architecture
Basic linux architectureRohit Kumar
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O YourHelper1
 
Session9-File Upload Security
Session9-File Upload SecuritySession9-File Upload Security
Session9-File Upload Securityzakieh alizadeh
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file managementKalai Selvi
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptxMODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptxManasaPJ1
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.pptMeesanRaza
 

Similar to File management53(1) (20)

File system interface
File system interfaceFile system interface
File system interface
 
Os6
Os6Os6
Os6
 
Linux 4 you
Linux 4 youLinux 4 you
Linux 4 you
 
Learn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptLearn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems ppt
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access method
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.ppt
 
5263802.ppt
5263802.ppt5263802.ppt
5263802.ppt
 
Javase7 1641812
Javase7 1641812Javase7 1641812
Javase7 1641812
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 
Python file handling
Python file handlingPython file handling
Python file handling
 
Linux: Basics OF Linux
Linux: Basics OF LinuxLinux: Basics OF Linux
Linux: Basics OF Linux
 
Ch10 file system interface
Ch10   file system interfaceCh10   file system interface
Ch10 file system interface
 
Basic linux architecture
Basic linux architectureBasic linux architecture
Basic linux architecture
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
Session9-File Upload Security
Session9-File Upload SecuritySession9-File Upload Security
Session9-File Upload Security
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file management
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptxMODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptx
 
File Systems
File SystemsFile Systems
File Systems
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
Systems Programming - File IO
Systems Programming - File IOSystems Programming - File IO
Systems Programming - File IO
 

More from myrajendra

More from myrajendra (20)

Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 
Properties
PropertiesProperties
Properties
 
Java.sql package
Java.sql packageJava.sql package
Java.sql package
 
Interface callable statement
Interface callable statementInterface callable statement
Interface callable statement
 

File management53(1)

  • 1. File Management Organization of data - Creating a file - Storing a file in required directory - Removing a file - Opening a file - Closing a file - Maintaining of file details - Name, Type, location, size , date and time of creation or modification - File Protection http://raj-os.blogspot.in/ 1
  • 2. File Attributes - Name - Type - Location - Size - Protection - Time, Date and User Identification http://raj-os.blogspot.in/ 2
  • 3. File Attributes Name - Given by the user - Only information that is kept in human readable form Type - Information required by systems that support different types http://raj-os.blogspot.in/ 3
  • 4. File attributes Location - A pointer to a device and to the location of the file on that device Size - Current size of file (in bytes or words ) - Max size allowed http://raj-os.blogspot.in/ 4
  • 5. File Attributes Protection - Access control information ( read, write and execute privileges ) http://raj-os.blogspot.in/ 5
  • 6. File Attributes Time, date and user identification - Creation - Last modification - Last use (Useful for protection, security and usage monitoring ) http://raj-os.blogspot.in/ 6
  • 7. Basic File Operations ( Minimal Set ) 1. Creating a file 2. Repositioning within a file 3. Deleting a file 4. Truncating a file 5. Reading a file 6. Writing a file http://raj-os.blogspot.in/ 7
  • 8. Basic File Operations 1. Creating a file • Allocation of space for the file in the file system • Making an entry for the new file in the directory http://raj-os.blogspot.in/ 8
  • 9. Basic File Operations 2. Writing a file • Use a system call specifying - Name of the file - Information to be written • Search directory for the associated entry • Keep a write pointer • Update write pointer after every write http://raj-os.blogspot.in/ 9
  • 10. Basic File Operations 3. Reading a file • Use a system call specifying - Name of the file - Address where to put the contents read • Search directory for the associated entry • Keep a read pointer • Update read pointer after every read http://raj-os.blogspot.in/ 10
  • 11. Basic File Operations 4. Repositioning within a file • Also known as file seek operation • Search directory for the appropriate entry • Set current-file-position to a given value http://raj-os.blogspot.in/ 11
  • 12. Basic File Operations 5.Deleting a file • Search the directory for the named file • Release all file space • Erase the directory entry http://raj-os.blogspot.in/ 12
  • 13. Basic File Operations 6. Truncating a file • File contents erased • Name and attributes of file unchanged http://raj-os.blogspot.in/ 13
  • 14. Other File Operations • Appending • Renaming Appending Add some information at the end of the file Renaming Name of file changed All other attributes unchanged http://raj-os.blogspot.in/ 14
  • 15. Basic file operations can be combined to implement other operations Ex : Creating a copy of a file - Create a new file - Read from old file - Write to new file http://raj-os.blogspot.in/ 15
  • 16. Other Desirable Operations Allow the user to get and set the various attributes of a file Ex : i) get the file length ii) set file attributes like file’s owner http://raj-os.blogspot.in/ 16
  • 17. Other Desirable Operations Most file operations involve searching the directory for the entry associated with the named file http://raj-os.blogspot.in/ 17
  • 18. To Avoid Constant Searching • Many systems open a file when file first is used • The operating system keeps a small table called the Open file table • Open file table contains information about open files • When a file operation is requested, an index into the open file table is used http://raj-os.blogspot.in/ 18
  • 19. Other File Operations When a file is no longer actively used, it is closed by the process and the O.S. removes its entry in the Open file table http://raj-os.blogspot.in/ 19
  • 20. Other File Operations • Some systems implicitly open a file when it is first referenced • Close it automatically when the program that opened the file terminates http://raj-os.blogspot.in/ 20
  • 21. Other File Operations Most systems require that a file be opened explicitly by the programmer with a system call ( open ) before that file can be used http://raj-os.blogspot.in/ 21
  • 22. File Type Usual extension Function Executable Exe, com, bin or none Ready to run machine language program Object obj, o Compiled, machine language, not linked Source code c, p, pas, f77, asm, a Source code in various languages Batch bat, sh Commands to the command interpreter Text txt, doc textual data,documents Word Wp, tex, rrf etc Various word processor Processor formats Library Lib, a Libraries of routines Print or view ps, dvi, gif ASCII or binary file in a format for printing or viewing Archive arc, zip, tar Related group of files for archiving or storage Fig : Common File Types http://raj-os.blogspot.in/ 22
  • 23. File Type One major consideration in designing a file system, and the entire operating system, is whether the operating system should recognize and support file types http://raj-os.blogspot.in/ 23
  • 24. File Type • If the operating system recognizes the type of a file • it can then operate on the file in reasonable ways • Ex : An attempt to print a binary-object form of a program file can be prevented http://raj-os.blogspot.in/ 24
  • 25. File Type To implement file types, include the type as part of the file name For Ex : letters , documents http://raj-os.blogspot.in/ 25
  • 26. File Type The file name is split into two parts - a name - an extension http://raj-os.blogspot.in/ 26
  • 27. File Type • The file name is usually separated from the extension by a period ( dot ) character Ex : paycalc. cpp • The name can consists up to 8 characters followed by a period http://raj-os.blogspot.in/ 27
  • 28. File Type The extension tells what the file type is • Extension can be up to 3 characters • System uses the extension to indicate the type of the file • Type of operations that can be done on that file For ex : .com , .exe & .bat extension are executable file http://raj-os.blogspot.in/ 28
  • 29. Summary In this class, you have learnt - file concept - Understand file operations - Know various file types http://raj-os.blogspot.in/ 29