Docsity

Storage Management notes, Lecture notes of Computer Science

Partial preview of the text

Download Storage Management notes and more Lecture notes Computer Science in PDF only on Docsity!

Storage Management - 1 SCS 1205 (Lecturer Five)

By Jackline

Ssanyu

1

Lecture Five: Memory Management -

  • (^) Introduction
  • (^) Disk space management
  • (^) The file system Interface

Disk Management

 (^) Disk management is a utility built into different operating systems which can be used to create, delete, format partitions, assign drive letters, disk initialization, booting from disk, bad-block recovery and much more.  (^) Disk management can also be used to view partitions and their formatted file systems on the hard drive.

Disk Formatting

 (^) Disk formatting is the process of preparing a data storage device such as a hard disk drive, solid-state drive, or USB flash drive for initial use. In some cases, the formatting operation may also create one or more new file systems.  (^) Disk formatting is divided into three processes:

  • (^) Low-level formatting (physical formatting)
  • (^) Partitioning
  • (^) High-level formatting (logical formatting)

Partitioning

 (^) Before the disk can be used to hold files, the operating system still needs to record its own data structures on the disk.  (^) The partitioning process involves dividing the disk into one or more groups of cylinders. The operating system can treat each partition as though it were a separate disk. For instance, one partition can hold a copy of the operating system’s executable code, while another holds user files.

High-Level Formatting

 (^) High-level formatting helps in creating the file system format within the logical volume or within the disk partition.  (^) In this step, the operating system stores the initial file- system data structures onto the disk. These data structures may include maps of free and allocated space and an initial empty directory.

Boot Block

 (^) For a computer to start running—for instance, when it is powered up or restarted—it must have an initial program to run.  (^) This initial bootstrap program tends to be simple. It initializes all aspects of the system, from CPU registers to device controllers and the contents of main memory, and then starts the operating system.  (^) To do its job, the bootstrap program finds the operating-system kernel on disk, loads that kernel into memory, and jumps to an initial address to begin the operating-system execution.  (^) For most computers, the bootstrap is stored in read-only memory (ROM).  (^) A disk that has a boot partition is called a boot disk or system disk.

Bad Blocks  (^) Disks are prone to failure. Sometimes the failure is complete; in this case, the disk needs to be replaced and its contents restored from backup media to the new disk.  (^) More frequently, one or more sectors become defective. Most disks even come from the factory with bad blocks.  (^) Depending on the disk and controller in use, these blocks are handled in a variety of ways.

  • (^) On simple disks, bad blocks are handled manually by scanning the disk to find bad blocks while the disk is being formatted. Any bad blocks that are discovered are flagged as unusable so that the file system does not allocate them.
  • (^) If blocks go bad during normal operation, a special program (such as the Linux badblocks command) must be run manually to search for the bad blocks and to lock them away. Data that resided on the bad blocks usually are lost.
  • (^) More sophisticated disks are smarter about bad-block recovery. The controller maintains a list of bad blocks on the disk. The list is initialized during the low-level formatting at the factory and is updated over the life of the disk. Low-level formatting also sets aside spare sectors not visible to the operating system. The controller can be told to replace each bad sector logically with one of the spare sectors. This scheme is known as sector sparing or forwarding.

File Attributes

 (^) A file’s attributes vary from one operating system to another but typically consist of these:

  • (^) Name. The symbolic file name is the only information kept in human readable form.
  • Identifier. A unique tag, usually a number, identifies the file within the file system.
  • (^) Type. This information is needed for systems that support different types of files.
  • Location. This information is a pointer to a device and to the location of the file on that device.
  • (^) Size. The current size of the file (in bytes, words, or blocks) and possibly the maximum allowed size are included in this attribute.
  • (^) Protection. Access-control information determines who can do reading, writing, executing, and so on.
  • (^) Time, date, and user identification. This information may be kept for creation, last modification, and last use. These data can be^13

File Type

 (^) File type refers to the ability of the operating system to distinguish different types of file such as text files, pdf files, image files, source files and binary files etc. Many operating systems support many types of files.  (^) If an operating system recognizes the type of a file, it can then operate on the file in reasonable ways.  (^) A common technique for implementing file types is to include the type as part of the file name. The name is split into two parts—a name and an extension, usually separated by a period. E.g. resume.docx, server.c, and ReaderThread.cpp.  (^) In this way, the user and the operating system can tell from the name alone what the type of a file is.

File Structure

A File Structure should be according to a required

format that the operating system can

understand.

A file has a certain defined structure according to

its type.

  • (^) A text file is a sequence of characters organized into lines.
  • (^) A source file is a sequence of procedures and

functions.

  • (^) An object file is a sequence of bytes organized

into blocks that are understandable by the

machine. 16

File Access Mechanisms

 (^) Files store information. When it is used, this information must be accessed and read into computer memory. The information in the file can be accessed in several ways. Some systems provide only one access method for files, while others support many access methods. Generally, there two types of access methods:

  • (^) Sequential Access
  • (^) Direct Access or Random Access or Relative Access
  • (^) Index Access Method
  • (^) Index sequential Access Method

Direct or Random Access

Methods

 (^) With direct access, a file is made up of fixed-length logical records that allow programs to read and write records rapidly in no particular order.  (^) For direct access, the file is viewed as a numbered sequence of blocks or records on disk. Thus, we may read block 14, then read block 53, and then write block 7. There are no restrictions on the order of reading or writing for a direct- access file.  (^) Direct-access files are of great use for immediate access to large amounts of information.  (^) Databases are often of this type. When a query concerning a particular subject arrives, we compute which block contains the answer and then read that block directly to provide the desired information.  (^) Not all operating systems support both sequential and direct access for files. Some systems allow only sequential file access; others allow only direct access. Some systems require that a file be defined as sequential or direct when it is created.

Index Access Method

  • (^) Indexed access method is built on top of direct access. This method generally involves the construction of an index for the file. The index , like an index in the back of a book, contains pointers to the various blocks.
  • (^) To find a record in the file, we first search the index and then use the pointer to access the file directly and to find the desired record.