File. Why do we need files?- Storing information in memory is good becausememoryisfast-However,memoryvanishesafterprocesstermination- File provides a long-term information storage.. It is persistent and survives after process termination.-Fileisalso asharedobjectforprocessestoaccessconcurrently16
File 16 • Why do we need files? – Storing information in memory is good because memory is fast. – However, memory vanishes after process termination. – File provides a long-term information storage. • It is persistent and survives after process termination. – File is also a shared object for processes to access concurrently
File. What is a file?-A uniform logical view of stored informationprovided by Os.-Os perspective:Afile is a logical storage unit(asequence of logical records),it is an abstract data type-Userperspective:thesmallestallotmentof logicasecondarystorage- File type (executable, object, source code, textmultimedia, archive...)-Fileattributes-Fileoperations17
File 17 • What is a file? – A uniform logical view of stored information provided by OS. – OS perspective: A file is a logical storage unit (a sequence of logical records), it is an abstract data type – User perspective: the smallest allotment of logical secondary storage – File type (executable, object, source code, text, multimedia, archive.) – File attributes – File operations
File-whataregoingto bestored?. E.g., a text file.ndhWtest.txtWhatcan we find out inthis example?Content?Content of the fileFilename?Content of its parent directoryFile size?Attribute of the fileWhenafileisnamed,it becomesindependentoftheprocess,theuser,and eventhe system18
File – what are going to be stored? 18 • E.g., a text file. h e l l o _ w o r l d ‘\n’ test.txt Content? Content of the file Filename? Content of its parent directory What can we find out in this example? File size? Attribute of the file When a file is named, it becomes independent of the process, the user, and even the system
FileAttributes· Typical file attributesNameHuman-readableformIdentifierUniquetag (a numberwhich identifies thefilewithin theFs)TypeTextfilesourcefile.executablefile..LocationPointer to a device and to the location of the file on the deviceSizeNumberofbytes,words,orblocksTime, dateCreation,lastmodification,lastuse..ProtectionAccesscontrolinformation(read/write/execute)You can try the command "ls -I"19
File Attributes 19 • Typical file attributes Name Identifier Type Location Size Time, date Protection Human-readable form Unique tag (a number which identifies the file within the FS) Text file, source file, executable file. Pointer to a device and to the location of the file on the device Number of bytes, words, or blocks Creation, last modification, last use. Access control information (read/write/execute) You can try the command “ls -l