0% found this document useful (0 votes)
0 views

Operating System Structure

Uploaded by

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

Operating System Structure

Uploaded by

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

Operating System

Structure
PROCESS

• A process is a program in execution. The execution of a process must progress in a sequential


fashion.

• Program It is a static entity made up of program statement .


Differences between Process and Program

Process Program
Process is a dynamic object Program is a static object
Process is sequence of instruction
Program is a sequence of instructions
execution

Program loaded into secondary storage


Process loaded in to main memory
devices

Time span of process is limited Time span of program is unlimited

Process is a active entity Program is a passive entity


Process States
• When a process executed, it changes the state, generally the state of process is determined by
the current activity of the process. Each process may be in one of the following states:
• Process can have one of the following five states at a time.
Only one process can be running in any processor at any time, But many process may be in
ready and waiting states. The ready processes are loaded into a “ready queue
Process Control Block:

• Each process is represented in the operating System by a Process Control Block.


It is also called Task Control Block. It contains many pieces of information associated with a specific
Process.


Process Control Block
1. ProcessState : The State may be new, ready, running, and waiting,Terminated…
2. ProgramCounter : indicates the Address of the next Instruction to be executed.
3. CPUregisters : registers include accumulators, stack pointers,
General purpose Registers….
4. CPU-SchedulingInfo : includes a process pointer, pointers to
schedulingQueues,other scheduling parametersetc.
5. Memory management Info: includes page tables, segmentation tables, value of
base and limit registers.
6. AccountingInformation: includes amount of CPU used, time limits, Jobs(or)Process numbers.
7. I/O StatusInformation: Includes the list of I/O Devices Allocated to theprocesses, list of open
files.
Threads:
• A process is divide into number of light weight process, each light weight
process is said to be a Thread. The Thread has a program counter (Keeps track
of which instruction to execute next), registers (holds its current working
variables), stack (execution History).
Thread States:
1. born State : A thread is just created.
2. ready state : The thread is waiting for CPU.
3. running : System assigns the processor to the thread.
4. sleep : A sleeping thread becomes ready after the designated sleep time
expires.
5. dead : The Execution of the thread finished.
Eg: Word processor.
Typing, Formatting, Spell check, saving are threads.
Differences between Process and Thread


FILE CONCEPTS:

• A file is a collection of related information that is


recorded on secondary storage. From a user’s perspective,
a file is the smallest allotment of logical secondary storage
and data cannot be written to secondary storage unless
they are within a file.
• Four terms are in common use when discussing files: Field, Record, File and
Database
• A field is the basic element of data. An individual field contains a single value, such
as an employee’s
last name, a date, or the value of a sensor reading. It is characterized by its length and
data type.
• A record is a collection of related fields that can be treated as a unit by some
application program. For
example, an employee record would contain such fields as name, social security
number, job
classification, date of hire, and so on.
• A file is a collection of similar records. The file is treated as a single entity by users
and applications
and may be referenced by name.
• A database is a collection of related data. A database may contain all of the
information related to an
organization or project, such as a business or a scientific study. The database itself
consists of one or
more types of files.
• File Attributes:
A file has the following attributes:
• Name: The symbolic file name is the only information kept in human
readable form.
• Identifier: This unique tag, usually a number, identifies the file within the
file system; it is the nonhuman-readable name for the file.
• Type: This information is needed for those systems that support different
types.
• 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, modification
and last use. These data can be useful for protection, security, and
usage monitoring.
File Operations:
The operating system can provide system calls to create, write, read, reposition, delete, and
truncate files. The file operations are described as followed:
➔ Creating a file: Two steps are necessary to create a file. First, space in the file system must
be found
for the file. Second, an entry for the new file must be made in the directory. The directory entry
records
the name of the file and the location in the file system, and possibly other information.
➔ Writing a file: To write a file, we make a system call specifying both the name of the file
and the
information to be written to the file. Given the name of the file, the system searches the directory
to find
the location of the file. The system must keep a write pointer to the location in the file where the
next
write is to take place. The write pointer must be updated whenever a write occurs.
➔ Reading a file: To read from a file, we use a system call that specifies the name of the file
and where
(in main memory) the next block of the file should be put. Again, the directory is searched for
the
associated directory entry, and the system needs to keep a read pointer to the location in the file
where
the next read is to take place. Once the read has taken place, the read pointer is updated.
➔ Repositioning within a file: The directory is searched for the appropriate
entry, and the current-file position is set to a given value. Repositioning within a
file does not need to involve any actual I/O. This
file operation is also known as a file seeks.
➔ Deleting a file: To delete a file, we search the directory for the named file.
Having found the associated
directory entry, we release all file space, so that it can be reused by other files,
and erase the directory
entry.
➔ Truncating a file: The user may want to erase the contents of a file but
keep its attributes. Rather than
forcing the user to delete the file and then recreate it, this function allows all
attributes to remain
unchanged-except for file length-but lets the file be reset to length zero and its
file space released.
File Types:
The files are classified into different categories as follows:

You might also like