Вы находитесь на странице: 1из 11

FILE MANAGEMENT vs FILE

PROCESSING
File Management System
The file management system, FMS is the subsystem of an operating system that manages the data storage
organisation on secondary storage and provides services to processes data related to their access.

In this sense, it is the interface between the application programs and the low-level media-I/O (e.g. disk
I/O) subsystem, deal with low-level intricacies and allowing them to implement I/O using convenient
data-organisational abstractions such as files and records.

On the other hand, the FMS services often are the only ways through which applications can access the
data stored in the files, where data are captured, which can be usefully exploited for the purposes of data
protection, maintenance and control.

Typically, the only way that a user or application may access files is through the file management system.
This relieves the user or programmer of the necessity of developing special-purpose software for each
application and provides the system with a consistent, well-defined means of controlling its most
important asset.

Goals of File Management System


•Data Management: An FMS should provide data management services to applications through
convenient abstractions, simplifying and making device-independent of the common operations involved
in data access and modification.

• Generality with respect to storage devices: The FMS data abstractions and access methods should
remain unchanged irrespective of the devices involved in data storage.

• Validity: An FMS should guarantee that at any given moment the stored data reflect the operations
performed on them, regardless of the time delays involved in actually performing those operations.
Appropriate access synchronization mechanism should be used to enforce validity when multiple accesses
from independent processes are possible.

• Protection: Illegal or potentially dangerous operations on the data should be controlled by the FMS, by
enforcing a well-defined data protection policy.

• Concurrency: In multiprogramming systems, concurrent access to the data should be allowed with
minimal differences with respect to single-process access, save for access synchronization enforcement.

• Performance: The above functionalities should be offered or achieving, at the same a good compromise
in terms of data access speed and data transferring rate.
Functions of File Management
With respect to meeting user requirements, the extent of such requirements depends on the variety of
applications and the environment in which the computer system will be used. For an interactive, general
purpose system, the under listed constitutes a minimal set of requirements:

• Each user should be able to create, delete, read, write, and modify files.

• Each user may have controlled access to other users’ files.

• Each user may control what types of accesses are allowed to the user’s files.

• Each user should be able to restructure the user’s files in a form appropriate to the problem.

• Each user should be able to move data between files.

• Each user should be able to back up and recover the user’s files in case of damage.

• Each user should be able to access his or her files by name rather than by numeric identifier.

Fundamental File Processing Operations


•Physical files and logical files

• Opening and closing files

• Reading from files and writing into files

Physical files and logical files


physical file: A collection of bytes stored on a disk or tape

logical file: A ”channel” (like a telephone line) that connects the program to a physical file –

The program (application) sends (or receives) bytes to (from) a file through the logical file.

The program knows nothing about where the bytes go (came from).
The operating system is responsible for associating a logical file and a program to a physical file in disk
or tape.

Writing to or reading from a file in a program is done through the operating system.

Note that from the program point of view, input devices (keyboard) and output devices (console, printer,
etc) are treated as files - places where bytes come from or are sent to.

There may be thousands of physical files on a disk, but a program only have about 20 logical files open at
the same time.

The physical file has a name, for instance myfile.txt

The logical file has a logical name used for referring to the file inside the program.

This logical name is a variable inside the program, for instance outfile In C programming language, this
variable is declared as follows:

FILE * outfile;

In C++ the logical name is the name of an object of the class fstream:

fstream outfile;

In both languages, the logical name outfile will be associated to the physical file myfile.txt at the time of
opening the file.

Opening Files
Opening a file makes it ready for use by the program.

There Two options for opening a file :

• open an existing file

• create a new file

When we open a file we are positioned at the beginning of the file.

In C : . . .

FILE * outfile;

outfile = fopen("myfile.txt", "w");

The first argument indicates the physical name of the file.

The second one determines the “mode”, i.e. the way, the file is opened.
For example : “r” = open for reading,

“w” = open for writing (file need not to exist),

“a” = open for appending (file need not to exist).

Closing Files
This is like “hanging up” the line connected to a file.

After closing a file, the logical name is free to be associated to another physical file.

Closing a file used for output guarantees everything has been written to the physical file.

NOTE: Those bytes are not sent directly to the physical file one by one; they are first stored in a buffer
to be written later as a block of data. When the file is closed the leftover from the buffer is flushed to the
file.

Files are usually closed automatically by the operating system at the end of program’s execution.

It’s better to close the file to prevent data loss in case the program does not terminate normally.

In C : fclose(outfile);

In C++ : outfile.close();

Reading data
Read data from a file and place it in a variable inside the program.

Generic Read function (not specific to any programming language)

Read(Source_file, Destination_addr, Size)

Source file = logical name of a file which has been opened

Destination addr = first address of the memory block were data should be stored

Size = number of bytes to be read.


Writing data
Write data from a variable inside the program into the file.

Generic Write function : Write (Destination_File, Source_addr, Size)

Destination file = logical file name of a file which has been opened

Source addr = first address of the memory block where data is stored

Size = number of bytes to be written In C (or in C++ using C streams)

CLASS EXERCISE
Write a program that writes SEVEN lines of text to a file named
Fprocessing.txt
 You must be able to read the contents of Fprocessing.tx with a text
editor.
File Extension

Text Files
.DOC Microsoft Word Document
.DOCX Microsoft Word Open XML Document
.LOG Log File
.MSG Outlook Mail Message
.ODT OpenDocument Text Document
.PAGES Pages Document
.RTF Rich Text Format File
.TEX LaTeX Source Document
.TXT Plain Text File
.WPD WordPerfect Document
.WPS Microsoft Works Word Processor Document
Data Files
.CSV Comma Separated Values File
.DAT Data File
.GED GEDCOM Genealogy Data File
.KEY Keynote Presentation
.KEYCHAIN Mac OS X Keychain File
.PPS PowerPoint Slide Show
.PPT PowerPoint Presentation
.PPTX PowerPoint Open XML Presentation
.SDF Standard Data File
.TAR Consolidated Unix File Archive
.TAX2014 TurboTax 2014 Tax Return
.TAX2015 TurboTax 2015 Tax Return
.VCF vCard File
.XML XML File
Audio Files
.AIF Audio Interchange File Format
.IFF Interchange File Format
.M3U Media Playlist File
.M4A MPEG-4 Audio File
.MID MIDI File
.MP3 MP3 Audio File
.MPA MPEG-2 Audio File
.WAV WAVE Audio File
.WMA Windows Media Audio File
Video Files
.3G2 3GPP2 Multimedia File
.3GP 3GPP Multimedia File
.ASF Advanced Systems Format File
.AVI Audio Video Interleave File
.FLV Flash Video File
.M4V iTunes Video File
.MOV Apple QuickTime Movie
.MP4 MPEG-4 Video File
.MPG MPEG Video File
.RM RealMedia File
.SRT SubRip Subtitle File
.SWF Shockwave Flash Movie
.VOB DVD Video Object File
.WMV Windows Media Video File
3D Image Files
.3DM Rhino 3D Model
.3DS 3D Studio Scene
.MAX 3ds Max Scene File
.OBJ Wavefront 3D Object File
Raster Image Files
.BMP Bitmap Image File
.DDS DirectDraw Surface
.GIF Graphical Interchange Format File
.JPG JPEG Image
.PNG Portable Network Graphic
.PSD Adobe Photoshop Document
.PSPIMAGE PaintShop Pro Image
.TGA Targa Graphic
.THM Thumbnail Image File
.TIF Tagged Image File
.TIFF Tagged Image File Format
.YUV YUV Encoded Image File
Vector Image Files
.AI Adobe Illustrator File
.EPS Encapsulated PostScript File
.PS PostScript File
.SVG Scalable Vector Graphics File
Page Layout Files
.INDD Adobe InDesign Document
.PCT Picture File
.PDF Portable Document Format File
Spreadsheet Files
.XLR Works Spreadsheet
.XLS Excel Spreadsheet
.XLSX Microsoft Excel Open XML Spreadsheet
Database Files
.ACCDB Access 2007 Database File
.DB Database File
.DBF Database File
.MDB Microsoft Access Database
.PDB Program Database
.SQL Structured Query Language Data File
Executable Files
.APK Android Package File
.APP Mac OS X Application
.BAT DOS Batch File
.CGI Common Gateway Interface Script
.COM DOS Command File
.EXE Windows Executable File
.GADGET Windows Gadget
.JAR Java Archive File
.WSF Windows Script File
Game Files
.DEM Video Game Demo File
.GAM Saved Game File
.NES Nintendo (NES) ROM File
.ROM N64 Game ROM File
.SAV Saved Game
CAD Files
.DWG AutoCAD Drawing Database File
.DXF Drawing Exchange Format File
GIS Files
.GPX GPS Exchange File
.KML Keyhole Markup Language File
.KMZ Google Earth Placemark File
Web Files
.ASP Active Server Page
.ASPX Active Server Page Extended File
.CER Internet Security Certificate
.CFM ColdFusion Markup File
.CSR Certificate Signing Request File
.CSS Cascading Style Sheet
.HTM Hypertext Markup Language File
.HTML Hypertext Markup Language File
.JS JavaScript File
.JSP Java Server Page
.PHP PHP Source Code File
.RSS Rich Site Summary
.XHTML Extensible Hypertext Markup Language File
Plugin Files
.CRX Chrome Extension
.PLUGIN Mac OS X Plugin
Font Files
.FNT Windows Font File
.FON Generic Font File
.OTF OpenType Font
.TTF TrueType Font
System Files
.CAB Windows Cabinet File
.CPL Windows Control Panel Item
.CUR Windows Cursor
.DESKTHEMEPACK Windows 8 Desktop Theme Pack File
.DLL Dynamic Link Library
.DMP Windows Memory Dump
.DRV Device Driver
.ICNS Mac OS X Icon Resource File
.ICO Icon File
.LNK Windows File Shortcut
.SYS Windows System File
Settings Files
.CFG Configuration File
.INI Windows Initialization File
.PRF Outlook Profile File
Encoded Files
.HQX BinHex 4.0 Encoded File
.MIM Multi-Purpose Internet Mail Message File
.UUE Uuencoded File
Compressed Files
.7Z 7-Zip Compressed File
.CBR Comic Book RAR Archive
.DEB Debian Software Package
.GZ Gnu Zipped Archive
.PKG Mac OS X Installer Package
.RAR WinRAR Compressed Archive
.RPM Red Hat Package Manager File
.SITX StuffIt X Archive
.TAR.GZ Compressed Tarball File
.ZIP Zipped File
.ZIPX Extended Zip File
Disk Image Files
.BIN Binary Disc Image
.CUE Cue Sheet File
.DMG Mac OS X Disk Image
.ISO Disc Image File
.MDF Media Disc Image File
.TOAST Toast Disc Image
.VCD Virtual CD
Developer Files
.C C/C++ Source Code File
.CLASS Java Class File
.CPP C++ Source Code File
.CS Visual C# Source Code File
.DTD Document Type Definition File
.FLA Adobe Flash Animation
.H C/C++/Objective-C Header File
.JAVA Java Source Code File
.LUA Lua Source File
.M Objective-C Implementation File
.PL Perl Script
.PY Python Script
.SH Bash Shell Script
.SLN Visual Studio Solution File
.SWIFT Swift Source Code File
.VB Visual Basic Project Item File
.VCXPROJ Visual C++ Project
.XCODEPROJ Xcode Project
Backup Files
.BAK Backup File
.TMP Temporary File
Misc Files
.CRDOWNLOAD Chrome Partially Downloaded File
.ICS Calendar File
.MSI Windows Installer Package
.PART Partially Downloaded File
.TORRENT BitTorrent File

Вам также может понравиться