You are on page 1of 81

STRUCTURED SYSTEM ANALYSIS AND

DESIGN BY PROF YK
UNIT THREE

By Prof YK
12/8/21 2
SIDDHIVINAYAK CLASSES
 DESIGNING THE APPLICATION ARCHITECTURE
1. It consists of application software programs that will carry out the function of the
system.
2. Application design must be done in the conjunction with the design of the database.
3. Application design must be done in the conjunction with the design of the user
interface.

By Prof YK
12/8/21 3
SIDDHIVINAYAK CLASSES
 SYSTEM FLOW CHART
1. It is an diagram that describes the overall flow of control between computer
programs in a system.
2. It also shows the relationships among
a) various programs.
b) subsystems.
c) Files or database.
3. It documents the architectural structure of the overall system.
4. Processes are grouped into programs and subsystems based on similarities such as
• shared timing.
• Access to store data.
• Users.
5. It graphically describes the organization of the subsystems into automated and
manual components showing the data flow , flow of control and interactions with
permanent data stores.
6. It is also used to describe systems that perform batch processing.

By Prof YK
12/8/21 4
SIDDHIVINAYAK CLASSES
7. In system flow chart, the individual data stores have been converted into database files.

Symbols Used 

By Prof YK
12/8/21 5
SIDDHIVINAYAK CLASSES
 Structured Chart

 It is used to create a top-down decomposition of the functions to be performed by a


given program in a new system.
 It always provides hierarchical organization of program functions.
 It shows relationship between the modules of a computer program.
 In structured chart level , we are not concerned with what is happening inside the
module.
 The module at the very top of the tree is the boss module.
 Order of module call will be always from left to Right.
 structured chart maintains the strict hierarchy in the calling structure. Lower level
modules NEVER Calls Higher level modules.
 The curved arrow immediately below the higher level module indicates a looping of the
modules to be called.

By Prof YK
12/8/21 6
SIDDHIVINAYAK CLASSES
Symbols Used in Structured Chart.

MODULE

COMMON SUB-ROUTINE
MODULE

CONTROL FLAG

DATA COUPLE

By Prof YK
12/8/21 7
SIDDHIVINAYAK CLASSES
DEVELOPING STRUCTURED CHART

There are two methods to design and develop structure chart.


1. Transaction Analysis.

• The development of a structured chart based on a DFD that describes the


processing for several types of transaction.
• System flow chart and event table are use to develop the top level of the tree.
• It is a process of identifying each separate transaction that must be supported by
the program and constructing a branch for each one.

2. Transform Analysis.

• The development of a structure chart based on a DFD that describes the input
process, output process, Dataflow.
• It uses DFD fragments to develop sub trees, one for each event in a program.
• Each sub-tree root module corresponds to the first level branch of the main
program structure chart.
• It is based on the idea that computer program transforms input data into output
information.
By Prof YK
12/8/21 8
SIDDHIVINAYAK CLASSES
• General form a structure chart developed with transform analysis is input-process-output.
Following Steps are followed to create Structure charts:
1. Determine the primary information flow.
2. Find the process that represents the most fundamental change from an input stream to
an output stream.
The output data stream is called the efferent data flow and central process is called
central transform.
3. Redraw the data flow diagram according to the DFD rules omitting non primary data.
4. Generate first draft structure chart, based on the redrawn data flow, with calling hierarchy
and the required data couples.
5. Add other modules as necessary.
6. Add other required inter module relationships such as looping and decisions using
Structured English or Decision Tables.
7. Make the final requirement to the structure chart based on the quality control
concepts.

By Prof YK
12/8/21 9
SIDDHIVINAYAK CLASSES
Integrity Control.

• Integrity control mechanism and procedure that are built into the system to safeguard
both the system and the information contained within it.
• Design of the interface must carefully consider mechanism to protect the system
integrity.

Objectives:
• To Ensure that only appropriate and correct Business Transaction occurs.
• To Ensure that the transaction are recorded and processed correctly.
i.e. to check for bugs, data entry errors and fraudulent processes.
• To protect and safeguard the assets(including information) of the organization against
computer crash and Catastrophes.

By Prof YK
12/8/21 10
SIDDHIVINAYAK CLASSES
System Access Control

• These are the mechanism that are established to restrict or control what portions of the
computer system a person can use.
• This category includes a control to limit access to certain applications or function within a
application.
• Advantage of this approach is that a consistent set of access controls is then applied to
every resource on a hardware platform or network.
• There are three categories of users:
1. Unauthorized User.
2. Registered User.
3. Privileged User.

By Prof YK
12/8/21 11
SIDDHIVINAYAK CLASSES
Managing User Access.

• Most Common Technique for managing user access to information System is a user
identifier(User ID) and Passwords.
• Two Techniques are used to defined Passwords:
1. Computer Generated.
2. User Defined.
• Some Syntax is always kept on passwords.
• The security system should be organized so that all resources can be access using the
same unique identifier and password combination.
• Another policy has to be designed to ensure ongoing security is that of changing
password periodically.
• A final Security step is to make sure the system keeps a record or attempted logons.

By Prof YK
12/8/21 12
SIDDHIVINAYAK CLASSES
Input Integrity Controls:

• They are used with all input mechanism.


• As a system may need certain amount of information for valid entry but an input device
cannot ensure that all necessary fields have been entered, An additional level of
verification, which will call a control for necessary check for completeness.
• Most Common control method to ensure correct input was to enter data twice. This
technique is called Keypunch Verify.
• Common Control Technique that are used today are:
1. Field Combination Control.
E.g.: On a insurance policy, the application date must be prior to the date of policy.
2. Value Limit Control.
3. Completeness Control.
4. Data Validation Control.

By Prof YK
12/8/21 13
SIDDHIVINAYAK CLASSES
Output Integrity Control
The purpose of output integrity controls is to ensure that output arrives at the proper
destination and is correct ,accurate ,current and complete.
Especially important that reports with sanative information arrive at the proper
destination and they cannot be accessed by unauthorized persons.

Following items are controls that should be printed on reports:


1. Date and Time of report Printing.
2. Date and Time of data on report.
3. Time period covered by report.
4. Beginning header with report identification and description.
5. Destination or routing information.
6. Pagination in the form of “page-of-”
7. Control Totals and Cross footings.
8. “ End of Report Trailer “
9. Report Version Number and Version Date.

By Prof YK
12/8/21 14
SIDDHIVINAYAK CLASSES
Design of input Systems

When designing inputs for the system. The system developer must perform four tasks:
1. Identify the devices and mechanism that will be used to enter input.
2. Identify all system inputs and develop a list with data content of each.
3. Determine what kinds of controls are necessary for each system input.
4. Design and prototype the electronic forms and other inputs.

Design of System outputs

When designing outputs for the system. The system developer must perform four tasks:
1. Determine the type of each output.
2. Make a list of specific outputs required based on application design.
3. Specify any necessary controls to protect the information provided in the output.
4. Design and prototype the report layout.

By Prof YK
12/8/21 15
SIDDHIVINAYAK CLASSES
Type of output
1. External output.
2. Internal Output.

Type of Report
1. Detailed Report.
2. Summary Report.
3. Exception Report.
4. Executive Report.
5. Control Break Report.
6. Screen Output.
7. Drill Down.
8. Linking.
9. Graphical and Multimedia Presentation.

By Prof YK
12/8/21 16
SIDDHIVINAYAK CLASSES
Interface Design

Eight Golden Rules:


1. Strive for Consistency.
2. Enable frequent user to use Shortcuts.
3. Offer informative feedback.
4. Design dialogs to yield closure.
5. Offer Simple Error Handling.
6. Permit Easy Reversal of action.
7. Support internal locus of control.
8. Reduce short term memory load.

By Prof YK
12/8/21 17
SIDDHIVINAYAK CLASSES
END OF UNIT THREE

By Prof YK
12/8/21 18
SIDDHIVINAYAK CLASSES
OPERATING SYSTEM
UNIT THREE
SYLLABUS

• MEMORY MANAGEMENT.
• FILE MANAGEMENT.
• I/O MANAGEMENT.
• DISK MANAGEMENT.

12/08/2021 20
MEMORY MANAGEMENT

12/08/2021 21
Memory is central to the operation of a modern computer system.
 Memory consists of a large array of words or bytes, each with its
own address.
 The CPU fetches instructions from according to the value of the
program counter.
 These instructions may cause additional loading from and storing
to specific memory addresses.
 A typical instruction-execution cycle, for example,
1. first fetches an instruction from memory.
2. The instruction is then decoded and may cause operands to be
fetched from memory.
3. After the instruction has been executed on the operands, results
may be stored back in the memory.
 

12/08/2021 22
What is Address Binding and explain Compile, Load and Execution Time ?
• Reloadable Address.
• Symbolic Address.

A user program may go through several steps before being executed. Addresses may be
represented in different ways during these. Addresses in the source program are generally
symbolic.

A compiler will typically bind these symbolic addresses to relocatable addresses and the
linkage loader will convert the relocatable addresses to absolute addresses.
Each binding is a mapping from one address space to another.

The binding can be done in the following ways:


Compile Time: If the address of the process is known at the compile time i.e. where the
process will stored in the memory, then the absolute code can be generated.
Load Time: If the address is not known at the compile time then the compiler must
generate the relocatable code. In this case, final binding is delayed until load time.
Execution Time: If the process can be moved during its execution from one memory
segment to another, then binding must be delayed until run time.
 
12/08/2021 23
What is Logical and Physical Address Space?

• An address generated by the CPU is commonly referred to as a logical address


• The address loaded in the memory address register of the memory is referred as physical
address.

What is dynamic loading ?

• With dynamic loading, a routine is not loaded until it is called. All routines are kept on disk
in a relocatable load format.

• The main program is loaded into memory and is executed.

• When a routine needs to call another routine, the calling routine first checks to see
whether the other routine has been loaded.

• If not, the relocatable linking loader is called to load the desired routine into memory and
then the control is passed to the newly loaded routine.

• Advantage: 1) An unused routine is never loaded.


2) It does not require special support from the OS.
  12/08/2021 24
Explain dynamic linking and sharing of libraries?

• Some OS supports static linking, in which system language libraries are treated like any
other object module and are combined by the loader into the binary program image.
•The concept of dynamic linking is similar to that of dynamic loading, where linking is
postponed until execution time.
•With dynamic linking, a stub is included in the image for each library routine reference.
•When the stub is executed, it checks to see whether the needed routine is already in
memory. If not, the program loads the routine in the memory.
•The stub replaces itself with the address of the routine and executes the routine.
•Using this scheme, all the processes that use a language, library execute only one copy of
the library code.
•This feature can be extended to library updates, in which the program references the new
version of the library automatically.
•Without dynamic linking, all the programs would need to be relinked to gain access to the
new library.

DISADVANTAGE:
•Thus, only programs that are compiled with the new library version are affected by the
incompatible changes incorporated in it.
•Other programs linked before the new library was installed will continue using the older
library.
  12/08/2021 25
Write a shot note on swapping?

•A process must be in the memory to be executed.


•A process however, can be swapped temporarily out of memory to
a backing store and then brought in the memory for continued
execution.
•A variant of this swapping policy is used for priority-based
scheduling algorithms.
•This variant of swapping is sometimes called roll out, roll in.
•Process that is swapped out will be swapped back into the same
memory space. This restriction is dictated by address binding.
•If binding is done at assembly or load time, then the process
cannot be easily moved to a different location.
•If execution-time binding is being used, however, then a process
can be swapped into a different memory space, because the
physical addresses are computed during execution time.
•Swapping
12/08/2021
requires a backing store (fast disk). 26
Explain contiguous memory allocation method and its strategies

 The memory is divided into two partitions: one for the resident OS and one for the user
processes.
 The OS is placed either in the low or high memory.
 The major factor affecting this decision is the location of the interrupt vector.
 Since the interrupt vector is often in low memory, programmers usually place the OS in
the low memory as well.
 Simplest method is to divide the memory into several fixed – partitions. Each partition
may contain exactly one process. Thus, degree of multiprogramming is bound by the number
of partition.
When process terminates, the partition becomes available for another process.
In fixed partition scheme, the OS keeps a table indicating which parts of memory are
available & which are occupied.
Initially all memory is available for user processes & is considered as one large block of
available memory, a hole.
When a process arrives and needs memory, we search for a hole enough for this process
and used as much needed.

12/08/2021 27
The Strategies
1. First Fit: Allocate first hole that is large enough.
2. Best Fit: Allocate smallest hole that is large enough.
3. Worst Fit: Allocate the largest hole.

* Fragmentation:
•Both first and best fit suffer from external fragmentation.
• As processes are loaded & removed from the memory the free space is broken into
little pieces.
•External fragmentation exists when there is enough total memory space to satisfy a
request but spaces are not contiguous.
•This fragmentation problem can be severe. i.e. we could have a block of free spaces
between every two processes.
•Statistics analysis of first bit, for instance, reveals that, given N allocated blocks,
another 0.5N blocks will be lost to fragmentation. i.e. one-third of memory is wasted.
This property is known as the 50-percent rule. It can be external or internal.
Solution: Compaction

12/08/2021 28
What is paging
 
•Paging avoids the considerable problem of fitting memory chunks of varying sizes onto the
backing store.
•The basic method for implementing paging involves breaking physical memory into fixed-
sized blocks called frames and breaking logical memory into blocks of the same size called
pages.
•When a process is to be executed, its pages are loaded into available memory frames from
the backing store.
•The backing store is divided into fixed sized blocks that are of the same size as the memory
frames.
•Every address generated by the CPU is divided into two parts: A page number (P) and a page
offset (D).
•The page number is used as index into a page table.
• The page table contains base address of each page in physical memory.
• This base address is combined with the page offset to define the physical memory address
that is sent to the memory unit.
 
 

12/08/2021 29
What is Segmentation and Explain segmentation with paging?
 
Segmentation:
 
•It is a memory management scheme that supports the user view of memory. i.e. a
logical address space is a collection of segments.
•Each segment has a name and a length. Address specifies both the segments name &
the offset.
•Logical address consists of a two:
Duple: <Segment –number, offset>
 
Segmentation with paging:
• Here, logical – address space of a process is divided into partitions.
•The first partition consist of up to 8 MB segments that are private to that process.
•The second partition consist of up to 8 KB segment that are shared among all the
process.
•Info about the first partition is kept in the Local descriptor table (LDT); and Info about
the second partition is kept in the Global descriptor table (GDT).
•Each entry in the LDT and GDT consist of an 8 byte segment descriptor with detailed info
about a partition segment, including the base location and the limit of that segment.

12/08/2021 30
Virtual Memory Management:
 
•The common problem before programmers few years ago was how to fit large
programs into the small memory. The solution developed was to break
programs into small pieces called overlays.
• Although the swapping was done by operating system, the work of creating
number of layers in a program was done by a programmer which was a time
consuming job.
•The virtual memory is a memory management technique which does the
splitting of a program into number of pieces as well as swapping.
• The basic idea behind virtual memory is that the combine size of the program,
data and stack may exceed the amount of physical memory. The OS keeps only
those parts of the program in the memory which are required during execution
and the rest on the disc.
•Virtual memory is a memory management scheme that allows the execution of
process that may not be completely is main memory. In the other words, virtual
memory allows execution of partially loaded process. As a consequence user
programs can be larger than physical memory.
  12/08/2021 31
Advantages of virtual memory
 
1. The size of users program would no longer be considered by the available size of
physical memory.

2. Since each user utilizes less physical memory, more users can keep their programs
in the memory simultaneously which helps to improve CPU utilization and
throughput.

3. Since a process may be loaded into a space of arbitrary size, which in turn reduces
external fragmentation without the need to change the scheduled order of process
execution.

4. Moreover the amount of space in use by given process may be changing during its
memory residence. As a result the OS may speed up the execution of important
processes by allocating more physical memory.
 

12/08/2021 32
What is demand paging

• Virtual memory is commonly implemented by demand paging.


• A demand-paging system is similar to a paging system with swapping.
•When a process is to be swapped in, the pager guesses which pages will be used
before the process is swapped out again.
•Instead of swapping in a whole process, the pager brings only those necessary
pages into memory. Thus, it avoids reading into memory pages into memory pages
that will not be used anyway, decreasing the swap time and the amount of physical
memory needed.
•With this scheme, The valid-invalid bit scheme is used for this purpose. When the
bit is set to “valid”, the associated page is both legal and in memory. If the bit is set
to “invalid”, the page either is not valid or is valid but is currently on the disk.
•The page-table entry for a page that is brought into the memory is set as usual, but
the page-table entry for a page that is not currently in memory is either simply
marked invalid or contains the address of the page on the disk.
•Access to a page marked invalid causes a page-fault trap.

12/08/2021 33
The procedure for handling this page fault is
1. If a process refers to a page which is not in the physical memory then an internal table
kept with PCB of that process is checked to verify whether a memory reference to a
page was valid or not.
2. If the memory reference to a page was valid, but the page is missing, then the process
to bring the referenced page into the physical memory starts.
3. Free memory location is identified to bring the missing page.
4. By reading the storage disk, the desired page is brought back into the free memory
location.
5. Once the page is in the physical memory, the internal table kept with the PCB of that
process and the PMT is updated to indicate that the page is now in memory.
6. Restart the instruction that was interrupted due to the missing page.
 
The hardware to support demand paging is
 
7. Page table: This table has the ability to mark an entry invalid through a valid-invalid bit.
8. Secondary memory: This memory holds those pages that are not present in main
memory. The secondary memory is usually a high speed disk. It is known as the swap
device, and the section of disk used for this purpose is known as swap space.

12/08/2021 34
Explain page replacement

 Page replacement takes the following approach.


1. If no frame is free, we find one that is not currently being used and free it.
2. We can now use the freed frame to hold the page for which the process faulted.
3. We modify the page-fault service routine to include page replacement.

Page Replacement Algorithm:

 Find the location of the desired page on the disk.


 Find a free frame:
• If there is a free frame then use it.
• If there is no free frame then use page replacement algorithm to select a
victim frame.
• Write the victim frame to the disk; change the page and frame tables
accordingly.
 Read the desired page into the new free frame; change the page and frame
tables.
 Restart the user process.
12/08/2021 35
What are different page replacement algorithms

1. FIFO Page Replacement:


2. Optimal Page Replacement
3. Least Recently Used Page Replacement:

12/08/2021 36
Belady Anomaly

12/08/2021 37
END OF CHAPTER
FILE MANAGEMENT

12/08/2021 39
• Definition:
File is a collection of logically related data.

What are the different file attributes?

  Name: The symbolic file name is the only info kept in human readable form.
 Identifier: This unique tag, usually a number, identifies the file within the file system; it
is the non-human-readable name for the file.
 Type: This info is needed for systems that support different types of files.
 Location: This info is a pointer to a device and to the location of the file on that device.
 Size: The current size of the file and possibly the maximum allowed size are included in
this attribute.
 Protection: Access-control info determines who can do reading, writing, executing, and
so on.
 Time, date, and user identification: This info may be kept for creation, last modification,
and last use. These data can be useful for protection, security, and usage monitoring.
 

12/08/2021 40
Explain the different types of access methods?

• Sequential Access:
• Direct Access:
• Other Access Methods:
 

12/08/2021 41
Explain the different directory structures?
 
• Single Level Directory:

12/08/2021 42
•Two Level Directory:

Note : Tree Structure Directories:


12/08/2021 43
• Acyclic Graph Directories:

12/08/2021 44
Explain the file system structure?

Application programs

LOGICAL FILE SYSTEM

FILE ORGANIZATION MODULE

BASIC FILE SYSTEM

I / O Control

12/08/2021
DEVICES 45
Write a short note in directory implementation?
  
Linear List
A linear list of directory entries requires a linear search to find a particular entry.
To create a new file, we must first search the directory to be sure that no existing file has
the same name. Then, we add a new entry at the end of the directory.
To delete a file, we search the directory for the named file, and then release the space to
it.

Disadvantage:
1. Linear search which is very slow.

Hash Table
Here, linear list stores the directory entries, but a hash data structure is also used.
The hash table takes a value computed from the file name and returns a pointer to the
file name in the linear list.
So, the search time is decreased. Insertion and deletion are also fairly straightforward,
although some provision must be made for collisions.
Disadvantages:
1. Fixed size table and dependence of the hash function on that size.

12/08/2021 46
Explain the different types of allocation methods?
 
Contiguous Allocation
It requires each file to occupy a set of contiguous blocks on the disk.
Disk addresses a linear ordering on the disk.
Contiguous allocation of a file is defined by the disk address and
length of the first block.
Both sequential and direct accesses are supported by contiguous
allocation.

Disadvantages:
1. Finding space for a new file.
2. External fragmentation
 

12/08/2021 47
Linked Allocation
With linked allocation, each file is a linked list of disk blocks may be scattered
anywhere on the disk.
The directory contains a pointer to the first and last blocks of the file. To create a
new file, we simply create new entry in the directory.
With linked allocation, each directory entry has a pointer to the first block of the
file.

Advantage:
1. No external fragmentation
2. Any free block can used to satisfy a request.
3. Size of the files does not need to be declared when that file is created.

Disadvantage:
4. Effectively only for sequential access files.
5. Space required for pointers.
6. Reliability.
 
12/08/2021 48
Indexed Location
It brings all the pointers together into one location: the index block.
Each file has its own index block, which is an array of disk-block addresses.
The nth entry in the index block points to the nth block of the file.
The directory contains the address of the index block.
To read the nth block we use the pointer in the nth index block entry to find and
read the desired block.
When file is created, all pointers in the index block are set to nil.
When nth block is first written, a block is obtained from free space manager and
its address is put in the nth index block entry.
It supports direct access, without suffering from external fragmentation.

Disadvantage:
1. Wasted space.
 

12/08/2021 49
FREE SPACE MANAGEMENT

12/08/2021 50
 Bit Vector:
Normally free space list is implemented as a bit map or bit vector.
Each block is represented by one bit.
If the block is free, the bit is one. If the block is allocated the bit is zero.
Advantage: Relative simplicity & Efficiency.
 
 Linked list:
Here, we linked together all the free disk blocks, keeping a pointer to the first free block in
a special location on the disk and catching it in memory.
This first block contains a pointer to the next free disk block.
Disadvantage: We must read each block (for traversing the list) which requires substantial
I/O.
 
 Grouping:
 To store the address of n free blocks in the first free block.
The first n-1 of these blocks are actually free.
The last block contains the addresses of another n free blocks.
 
 Counting:
 Rather than address we can keep address of first free block and number (n) of free
contiguous blocks that follows the first block.

12/08/2021 51
END OF CHAPTER
DISK SCHEDULING

12/08/2021 53
Disk Scheduling

 The seek time is the time for the disk arm to move the heads to the cylinder containing
the desired sector.
 The rotational latency is the additional time waiting for the disk to rotate the desired
sector to the disk head.
 The disk bandwidth is the total number of bytes transferred, divided by the total time
between the first request for service and the completion of the last transfer.

Scheduling Techniques:

1. FCFS.
2. SSTF.
3. SCAN.
4. C-SCAN.
 

12/08/2021 54
Let us Consider disk queue with requests for I/O to blocks on cylinder.
98,183,37,122,14,124,65,67 and disk head is at 53.

1. First Come First Served.


53 ,98,183,37,122,14,124,65,67
Total : 640 Cylinders.

2. Shortest Seek Time First


53,65,67,37,14,98,122,124,183
Total : 236 Cylinder.

3. SCAN Algorithm
Assuming disk arm is heading towards zero.
53,37,14,65,67,98,122,124,183.

4. C-SCAN Algo
This is a special case of SCAN Algorithm.

12/08/2021 55
CPU SCHEDULING

12/08/2021 56
Scheduling Criteria
 CPU utilization – keep the CPU as busy as possible

1. Throughput – # of processes that complete their execution per


time unit
2. Turnaround time – amount of time to execute a particular
process
3. Waiting time – amount of time a process has been waiting in
the ready queue
4. Response time – amount of time it takes from when a request
was submitted until the first response is produced, not output
(for time-sharing environment)

12/08/2021 57
First Come First Served

Process Burst Time


P1 24
P2 3
P3 3

Suppose that the processes arrive in the order: P1 , P2 , P3


The Gantt Chart for the schedule is:
P1 P2 P3

0 24 27 30

Waiting time for P1 = 0; P2 = 24; P3 = 27


Average waiting time: (0 + 24 + 27)/3 = 17

12/08/2021 58
Shortest Job First Scheduling Algo

• Associate with each process the length of its next CPU burst.
• Use these lengths to schedule the process with the shortest time.

Two schemes:
1. Non-preemptive – once CPU given to the process it cannot be
preempted until completes its CPU burst.
2. preemptive – if a new process arrives with CPU burst length
less than remaining time of current executing process,
preempt. This scheme is know as the Shortest-Remaining-
Time-First (SRTF).

Note: SJF is optimal – gives minimum average waiting time for a


given set of processes.

12/08/2021 59
Example of Non-Preemptive SJF
Process Arrival Time Burst Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
SJF (non-preemptive)

P1 P3 P2 P4

0 3 7 8 12 16

Average waiting time = (0 + 6 + 3 + 7)/4 =4

12/08/2021 60
Example of Preemptive SJF

Process Arrival Time Burst Time


P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
SJF (preemptive)
P1 P2 P3 P2 P4 P1

0 2 4 5 7 11 16

Average waiting time = (9 + 1 + 0 +2)/4 = 3

12/08/2021 61
Round Robin Algorithm

•Each process gets a small unit of CPU time (time quantum),


usually 10-100 milliseconds.
• After this time has elapsed, the process is preempted and added
to the end of the ready queue.
•If there are n processes in the ready queue and the time quantum
is q, then each process gets 1/n of the CPU time in chunks of at
most q time units at once.
•No process waits more than (n-1)q time units.

12/08/2021 62
Example of RR with Time Quantum = 20

Process Burst Time


P1 53
P2 17
P3 68
P4 24
The Gantt chart is:

P1 P2 P3 P4 P1 P3 P4 P1 P3 P3

0 20 37 57 77 97 117 121 134 154 162

Typically, higher average turnaround than SJF, but better response.

12/08/2021 63
Multi Level Queue Scheduling

12/08/2021 64
Assignment:
PROCESS ARRIVAL TIME BURST TIME
01.
P1 0.0 8
P2 0.4 4
P3 1.0 1

PROCESS BURST TIME PRIORITY


02.
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2

Note: Assume quantum = 1 unit for RR Algorithm


12/08/2021 65
END OF OPERATING SYSTEM

12/08/2021 66
JAVA SCRIPT
What is the Document Object Model?
The Document Object Model is a platform- and language-neutral interface that will
allow programs and scripts to dynamically access and update the content, structure
and style of documents. The document can be further processed and the results of that
processing can be incorporated back into the presented page.

12/08/2021 BY PROF YK 68
12/08/2021 BY PROF YK 69
Window Object

1. The Window object is the top level object in the


JavaScript hierarchy.
2. The Window object represents a browser window.
3. A Window object is created automatically with every
instance of a <body> or <frameset> tag.

12/08/2021 BY PROF YK 70
Window Object Methods

12/08/2021 BY PROF YK 71
Method Description
alert() Displays an alert box with a message and an OK button
blur() Removes focus from the current window
clearInterval() Cancels a timeout set with setInterval()
clearTimeout() Cancels a timeout set with setTimeout()
close() Closes the current window
confirm() Displays a dialog box with a message and an OK and a
Cancel button
createPopup() Creates a pop-up window
focus() Sets focus to the current window
moveBy() Moves a window relative to its current position
moveTo() Moves a window to the specified position
open() Opens a new browser window
print() Prints the contents of the current window
prompt() Displays a dialog box that prompts the user for input
resizeBy() Resizes a window by the specified pixels
resizeTo() Resizes a window to the specified width and height
scrollBy() Scrolls the content by the specified number of pixels
scrollTo() Scrolls the content to the specified coordinates
setInterval() Evaluates an expression at specified intervals
setTimeout() Evaluates an expression after a specified number of
12/08/2021 BY PROF YK 72
milliseconds
Window Object Properties

12/08/2021 BY PROF YK 73
Property Description
Closed Returns whether or not a window has been closed
defaultStatus Sets or returns the default text in the statusbar of the window

Length Sets or returns the number of frames in the window


Name Sets or returns the name of the window
opener Returns a reference to the window that created the window

outerHeight Sets or returns the outer height of a window


outerWidth Sets or returns the outer width of a window
pageXOffset Sets or returns the X position of the current page in relation to the
upper left corner of a window's display area
pageYOffset Sets or returns the Y position of the current page in relation to the
upper left corner of a window's display area
Parent Returns the parent window
Scrollbars Sets whether or not the scrollbars should be visible
Self Returns a reference to the current window
Status Sets the text in the statusbar of a window
Statusbar Sets whether or not the browser's statusbar should be visible

Toolbar Sets whether or not the browser's tool bar is visible or not

12/08/2021 BY PROF YK 74
History Object
The History object is actually a JavaScript object, not an HTML DOM object.
The History object is automatically created by the JavaScript runtime engine and consists
of an array of URLs. These URLs are the URLs the user has visited within a browser
window.
The History object is part of the Window object and is accessed through the
window.history property.

Property Description
Length Returns the number of elements in the history list

Method Description
back() Loads the previous URL in the history list
forward() Loads the next URL in the history list
go() Loads a specific page in the history list

12/08/2021 BY PROF YK 75
EVENTS

12/08/2021 BY PROF YK 76
Properties of Event:

Property Description
Current Target The node at which the event is being
currently processed
Target The node on which the event occurred.
Event Phase A number specifying the phase of the event
1. CAPTURING_PHASE
2. AT_TARGET
3. BUBBLING_PHASE

Time Stamp A date object that specifies when the event


occurred.
Bubbles A Boolean that specifies whether this event
bubbles up the document tree.
Cancelable A Boolean that specifies whether the event
has a default action associated with it
that can be cancelled with the
prevent_default() method.

12/08/2021 BY PROF YK 77
INTERNET EXPLORER EVENT MODEL

12/08/2021 BY PROF YK 78
IE Event Object Description
Type A string that specifies the type of event
that had occurred.
srcElement The document element on which the
event occurred
Button An integer that specifies the mouse
button that was pressed.

Integer Meaning
1 Left button
2 Right button
For multiple4buttons we add up the
Middle button
values.
Client X , Client Y These integers specify the mouse
coordinates at the time of the event,
relative to the upper left corner.

12/08/2021 BY PROF YK 79
CONTD

IE Event Object Description


offsetX, offsetY These integers specify the position of the
mouse pointer source element.

Altkey, ctrlkey, shiftkey These Boolean values specifies whether


these keys were held down when the event
occur.

Key Code This integer specifies the key code for key
down , key up events and the unicode
character code for keypress events.

12/08/2021 BY PROF YK 80
END OF JAVA SCRIPT

12/08/2021 BY PROF YK 81

You might also like