0% found this document useful (0 votes)
19 views32 pages

CH 2 - File and Block

Uploaded by

Pop Robert
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views32 pages

CH 2 - File and Block

Uploaded by

Pop Robert
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

2 FIL E

R
E ER C
T
A
E

A P U T O
V
L

H
C M P IA
D

IN

C O L
A
V

D
H
P
COMPUTER FILE - DEFINITION

A block of arbitrary information or resource for storing


information, that is available to a computer program
and is usually based on some kind of durable storage.
WHAT IS A DURABLE FILE?

It remains available for programs to use after the


current program has finished.

Computer files can be considered as the modern


counterpart of paper documents which traditionally
were kept in offices' and libraries' files.
FILE CONTENTS

From the operating system perspective ….

A FILE IS JUST A SEQUENCE OF BINARY DIGITS.

At a higher level, where the content of the file is being


considered, these binary digits may represent integer
values or text characters, or anything else.
OPERATING SYSTEM (OS) - DEFINITION

 The software that manages the sharing of the


resources of a computer.

 Processes raw system data and user input.

 Responds by allocating and managing tasks and


internal system resources as a service to users and
programs of the system.
COMPUTER FILE SIZE
Expressed in bytes, that indicates how much storage is
associated with the file.

BYTE
- a unit of measurement of information storage, most
often consisting of eight bits.

In many computer architectures it is a unit of memory


addressing.

Historically, bytes have ranged


from five to twelve bits.
COMPUTER FILE INFORMATION
Information in a computer file can consist of smaller
packets of information (often called records or lines)
that are individually different but share some trait in
common.

FILE CONTENT

LINE OF TEXT
BINARY IMAGE
EXECUTABLE FILE
EXECUTABLE FILE

A file whose contents are meant to be interpreted as a


program by a computer.

It contains the binary representation of machine


instructions of a specific processor.

Specific naming convention (such as the name ending in


a filename extension ".bin" or ".exe").
COMPUTER FILES
Most computer files are used by computer programs.

These programs:
 create
 modify files for their own use on an as-needed basis.
 delete

The programmers who create the programs


decide:
 what files are needed,
 how they are to be used
 their names.
COMPUTER FILE

Files on a computer can be:


 created,
 moved,  COMPUTER
by or
 modified  USER
 deleted.

EXAMPLE Microsoft Word files are normally created and modified by the
Microsoft Word program in response to user commands, but the
user can also move, rename, or delete these files directly by
using a file manager program such as Windows Explorer.
COMPUTER FILE NAMES
Files are typically accessed using names (filenames).
In some operating systems, the name is associated with
the file itself. In others, the file is anonymous, and is
pointed to by links that have names.

Files (or links to files) can be located in directories,


which can contain subdirectories.
COMPUTER FILE NAMES

A name that refers to a file within a directory must be


unique.
A file's name and the path to the file's directory must
uniquely identify it among all other files in the computer
system.

Two files can not have the same name and path.
ORGANIZING COMPUTER FILES
Most computers organize files into hierarchies using:
 folders,
 directories
 catalogs.

Each folder can contain an arbitrary number of files,


and it can also contain other folders. These other folders
are referred to as subfolders.
ORGANIZING COMPUTER FILES
Subfolders can contain still more files and folders and
so on, thus building a TREE-LIKE STRUCTURE.

How many folders can be in a tree-like structure?

One "master folder" ("root folder") can


contain any number of levels of other folders
and files.
COMPUTER FILE PATH
Each file and folder has not only a name of its own, but
also a path,

THE PATH
identifies the folder or folders in which a file or folder
resides.

In the path, some sort of special character is used to


separate the file and folder names. SLASH

Example of path:
/Payroll/Salaries/Managers.doc
COMPUTER FILE EXTENSIONS

Many (but not all) computer systems use extensions in


file names to help identify what they contain, also
known as the file type.

On Windows computers, extensions consist of a dot


(period) at the end of a file name, followed by a few
letters to identify the type of file.

.txt Text file


.doc MS document

File-extensions.org – for unknown extensions


BLOCK (DATA STORAGE)

A sequence of bytes or bits, having a nominal length (a


block size).

Data thus structured is said to be blocked.

Blocking - the process of putting data into blocks

Blocking is used to facilitate the handling of the data-


stream by the computer program receiving the data.
Blocked data is normally read a
whole block at a time.
RECORD (in computer data processing)
A collection of data items arranged for processing by a
program.

Multiple records are contained in a file or data set.

The organization of data in the record is usually


prescribed by the programming language that defines
the record's organization and/or by the application that
processes it.

Records can be of:


- fixed-length
- variable length
RECORD (in a database)
A group of fields within a table that are relevant to a
specific entity.

Sometimes called: a row.

Example:
In a table called CUSTOMER CONTACT
INFORMATION, a row would likely contain fields such
as:
 ID number,  city,
 name,  telephone number
 street address,  Etc.
FILE FORMAT

A particular way to encode information for storage in a


computer file.

Since a disk drive, or indeed any computer storage, can


store only bits, the computer must have some way of
converting information to 0s and 1s and vice-versa.

Some file formats are designed to store very particular


sorts of data.
FILE FORMAT - EXAMPLES

JPEG format
- designed only to store static photographic images.

GIF format
- supports storage of both still images and simple
animations

QuickTime format
- can act as a container for many different types of
multimedia.

HTML is also text file, but adhere to


more specific rules which allow them
to be used for specific purposes.
SPECIFICATION DOCUMENTS FOR FILE FORMATS

A published specification document (often with a


reference implementation)

- describes exactly how the data is to be encoded,


- can be used to determine whether or not a particular
program treats a particular file format correctly.
SPECIFICATION DOCUMENTS FOR FILE FORMATS

There are file formats without specification documents.

Reasons:
- some file format developers view their specification
documents as trade secrets
- some file format developers never spend time writing
a separate specification document;
COMPUTER PROGRAMS
might include anywhere from a dozen instructions to
many millions of instructions for something like a word
processor or a web browser.

COMPUTER BUGS = ERRORS

Sometimes bugs are benign and do not affect the


usefulness of the program, in other cases they might
cause the program to completely fail (crash).
COMPUTER PROGRAM - EXAMPLE 1

Suppose a computer is being employed to drive a traffic


light. A simple stored program might say:

1. Turn off all of the lights 6. Wait for sixty seconds


2. Turn on the red light 7. Turn off the green light
3. Wait for sixty seconds 8. Turn on the yellow light
4. Turn off the red light 9. Wait for two seconds
5. Turn on the green light 10. Turn off the yellow light
11. Jump to instruction number (2)

With this set of instructions, the computer would cycle


the light continually through red, green, yellow and
back to red again until told to stop running the
program.
PROTECTING FILES
against accidental and deliberate damage.

Computers that allow acces for multiple users implement


file permissions to control who may or may not
 modify,
 delete,
 create files and folders.
PROTECTING FILES

A given user may be granted only permission:


 to modify a file or folder, but not to delete it;
 to create files or folders, but not to delete them.
 to see the contents of a file or folder for only certain
users
PROTECTING FILES
Read-only flag (protection mechanism)
When this flag is turned on for a file (which can be
accomplished by a computer program or by a human
user), the file can be examined, but it cannot be
modified.

This flag is useful for critical information that must not


be modified or erased, such as special files that are used
only by internal parts of the computer system.

Some systems also include a hidden flag to


make certain files invisible; this flag is used by
the computer system to hide essential system
files that users should not alter.
BACKING UP FILES
When computer files contain information that is
extremely important, a back-up process is used to
protect against disasters that might destroy the files.

Backing up files simply means making copies of the files


in a separate location so that they can be restored if
something happens to the computer, or if they are
deleted accidentally.
BACKING UP FILES

Most computer systems provide utility programs to assist in the back-


up process, which can become very time-consuming if there are many
files to safeguard.

Copying files to another hard disk in the same computer protects


against failure of one disk, but if it is necessary to protect against
failure or destruction of the entire computer.

Files are often copied to removable media such as writable CDs.


FILE SYSTEMS AND FILE MANAGERS

FILE SYSTEM
The way a computer organizes, names, stores and
manipulates files.

Most computers have at least one file system.


Some computers allow the use of several different file
systems.
FILE SYSTEMS AND FILE MANAGERS

File-manager programs are utility programs that allow


you to manipulate files directly.

They allow you to move, create, delete and rename files


and folders, although they do not actually allow you to
read the contents of a file or store information in it.

Every computer system provides at least one file-


manager program for its native file system.

Under Windows, the most commonly


used file manager program is
Windows Explorer.

You might also like