Owlcom software
basadOwlCom  Software
Let's Owl manage your files
Welcome Screenshots Buy now Download Write to Owl Subscribe to news FAQ Links
Fig. 7.26. Two ways to perform file operations The second way in the file system introduces two special system call: open-opening the file and close-closing the file. The system call to open it is open before any order transactions file, and close the file challenge to the closure-after working with the file. The main task is to transform call open character of the filename of its unique numeric name, copy of the file from the disk into the buffer area of memory and verification of the user to perform the requested operation. Close Call release buffer with the characteristics file, and makes it impossible to continue operations in the file without opening it again. Operation opening and closing a file in one form or another utverdilis operating systems long ago. Even in the "old " operating system, as OS/360, a macro OPEN, in which a special buffer, called DCB (Data Control Block), collected from various sources all desired characteristics of the data set (a concept close to the modern concept of a file) used later in the performance of read and write operations. Next basic system calls file operations are discussed in greater detail in the case into the UNIX operating system, in which they acquired the type, which today supports virtually all operating systems. Opening the file System open challenge to UNIX OS works with two arguments: a character named opened a file and open it. The regime said the opening of the system, which operations will be carried out over the file in the sequence of operations before the closure of the file systems close call, for example: read only, write only, or read and write. When you open the file first OS able to convert the first argument systemic challenge, which is a symbolic name of the file in its unique numeric name, which in the traditional UNIX file system is the descriptor index number. The procedure was considered above in the description of the file system s5. On descriptor index number inode file system is a record on disk and copies of her performance file into RAM. To keep copies of the index buffer descriptor used for the system virtual space. Specifications descriptor index transferred into RAM, housed in the structure of the so-called virtual descriptor vnode (virtual node). Vnode structure of the index file descriptor fields inode, and several of the following additional fields useful in carrying out operations with the file. index descriptor memory, reflecting: Do locked file; Is waiting to unlock the file any process; Do different characteristics of the file in memory of its disk copies from changing the contents of the index descriptor; is whether the file in memory of its disk copies from changing the contents of the file; Is the file of the mount. Logical device number file system containing the file. descriptor index number. In disk descriptor index this field is absent, as determined by the number of descriptor for the start of index descriptors. Count references to the vnode structure. In the same file in a period of time can be various processes, but the operating system does not create a separate process for each copy vnode structure, and for each file, which is currently working at least one process, stores exactly one copy virtual descriptor. When the file is opened OS verifies whether in system memory vnode structure opened file (the number of logical devices and descriptor index number, which identifies with the transformation of the symbolic name), and, if available, links to a count increased by one. When the closure of the file reference count is reduced by one, and if it is on an equal, the buffer that keeps this vnode is free. Using only a copy of the file, and some of the characteristics of file operations (for example, sign blocking), common to all workers file processes, saves system memory. Nevertheless, there are characteristics of each individual process, performing a sequence of operations with a particular file. For storage structure used in the UNIX file type, which, like vnode is stored in the system memory area. Each opening of the file OS checks the user process to perform the requested operation with the file and, if the tests are successful, in a system of the new memory structure I f i e, which explains how to open a file, and operations that process is going to produce the file (such as reading). Structure file contains fields such as: Token regime opening (read-only, read-write, etc.); vnode pointer to the structure; The ongoing shift in the file (variable offset) in the operation of reading / writing; About count references to the structure; pointer to the structure containing the right process, opening the file (this structure is in the process descriptor); pointers to the previous and subsequent file structure, linking all such structures in the double list. Partly offset stored in the file, allows OS remember position a pointer to byte file. When you open a file, the variable contains the start or end of file in bytes of a given regime opening. After the read / write operations pointer shifted to the number of bytes, which was read or written as a result of the operation. Next comes operations pointer in the condition in which it left the previous operation. Application software can manage the situation clearly pointer with System lseek call, which will be considered below. With each new opening any file OS creates a new file structure and places it in the linked list twice (Figure 7.27). Usually, under the custody of the file system area are limited area, so the total number of open files all processes at any time limit. After an operating system file structure pointer puts it in the table of open files, which is in the process. If the process several times opens the same file, the file structure is created for each operation opening. As a parent in the context of Trial UNIX inherited protsessom- descendant, a descendant of inherited and pointers to open all files parent to get them to perform the operation. System call open returns to a user process descriptor file, which is a record number in the table of open files. The file descriptor is locally significant only for the process that opened the file to the different processes the same meaning descriptor pointed to the different operations in general on different files. After opening its file descriptor is used in all future transactions with the file up to the apparent closure of the file. Thus, the descriptor file is a temporary unique name, but did not file, a sequence of operations with this file. To open a file / bin/prog1. Ehe mode read-only application programmer can use that expression in C: fd = open ( " '/ bin / progl.exe." 0_RDONLY): Here is fd integer variable holds the importance of open file descriptor. Its importance should be used in the operation data from the file / bin/prog1. Exe. In an unsuccessful attempt to open a file (no rights for zatrebovannoy operations wrong filename) fd variable the values are -1, which is an indicator of error for all UNIX system calls.
Welcome    Screenshots    Download    Buy now Write to Owl    Subscribe to Owl news   FAQ   Links  
Copyright 2004-2011 OwlCom Software .

Owl Commander

OISV - Organization of Independent Software Vendors - Contributing Member Software Submit .NET - FREE and PREMIUM search engines submission and software submission and software promotion service. Owl Commander

Valid HTML 4.01 Transitional