tybsc comp sci
TRANSCRIPT
-
8/7/2019 TYBsc Comp Sci
1/81
STRUCTURED SYSTEM ANALYSIS AND
DESIGN BY PROF YK
-
8/7/2019 TYBsc Comp Sci
2/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
2
UNIT THREE
-
8/7/2019 TYBsc Comp Sci
3/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
3
DESIGNING THE APPLICATION ARCHITECTURE1. 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.
-
8/7/2019 TYBsc Comp Sci
4/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
4
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 andmanual 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.
-
8/7/2019 TYBsc Comp Sci
5/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
5
7. In system flow chart, the individual data stores have been converted into database files.
Symbols Used
-
8/7/2019 TYBsc Comp Sci
6/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
6
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.
-
8/7/2019 TYBsc Comp Sci
7/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
7
Symbols Used in Structured Chart.
MODULE
COMMON SUB-ROUTINE
MODULE
CONTROL FLAG
DATA COUPLE
-
8/7/2019 TYBsc Comp Sci
8/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
8
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 bythe 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.
-
8/7/2019 TYBsc Comp Sci
9/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
9
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 controlconcepts.
-
8/7/2019 TYBsc Comp Sci
10/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
10
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.
-
8/7/2019 TYBsc Comp Sci
11/81
-
8/7/2019 TYBsc Comp Sci
12/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
12
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.
-
8/7/2019 TYBsc Comp Sci
13/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
13
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. Thistechnique 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.
-
8/7/2019 TYBsc Comp Sci
14/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
14
Output Integrity Control
The purpose of output integrity controls is to ensure that output arrives at the properdestination 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.
-
8/7/2019 TYBsc Comp Sci
15/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
15
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.
-
8/7/2019 TYBsc Comp Sci
16/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
16
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.
-
8/7/2019 TYBsc Comp Sci
17/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
17
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.
-
8/7/2019 TYBsc Comp Sci
18/81
March 16, 2011 By Prof YKSIDDHIVINAYAK CLASSES
18
END OF UNIT THREE
-
8/7/2019 TYBsc Comp Sci
19/81
OPERATING SYSTEMUNIT THREE
-
8/7/2019 TYBsc Comp Sci
20/81
SYLLABUS
MEMORY MANAGEMENT.
FILE MANAGEMENT.
I/O MANAGEMENT.
DISK MANAGEMENT.
3/16/2011 20
-
8/7/2019 TYBsc Comp Sci
21/81
MEMORY MANAGEMENT
3/16/2011 21
-
8/7/2019 TYBsc Comp Sci
22/81
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, resultsmay be stored back in the memory.
3/16/2011 22
-
8/7/2019 TYBsc Comp Sci
23/81
What is Address Binding andexplain Compile, Loadand 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 thelinkage 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.
3/16/2011 23
-
8/7/2019 TYBsc Comp Sci
24/81
What is Logicaland PhysicalAddress 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 dynamicloading ?
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.3/16/2011 24
-
8/7/2019 TYBsc Comp Sci
25/81
Explain dynamiclinking and sharing oflibraries?
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.3/16/2011 25
-
8/7/2019 TYBsc Comp Sci
26/81
Writea 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 requires a backing store (fast disk).3/16/2011 26
-
8/7/2019 TYBsc Comp Sci
27/81
Explain contiguous memoryallocation methodand 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.
3/16/2011 27
-
8/7/2019 TYBsc Comp Sci
28/81
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 intolittle 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
3/16/2011 28
-
8/7/2019 TYBsc Comp Sci
29/81
What is paging
Paging avoids the considerable problem of fitting memory chunks of varying sizes onto thebacking 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.
3/16/2011 29
-
8/7/2019 TYBsc Comp Sci
30/81
What is Segmentation and Explain segmentation withpaging?
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:
Segmentation withpaging:
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.
3/16/2011 30
-
8/7/2019 TYBsc Comp Sci
31/81
VirtualMemoryManagement:
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 executionand 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.3/16/2011 31
-
8/7/2019 TYBsc Comp Sci
32/81
Advantages ofvirtual 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 importantprocesses by allocating more physical memory.
3/16/2011 32
-
8/7/2019 TYBsc Comp Sci
33/81
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 pagesthat 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 legaland in memory. If the bit is set
to invalid, the page either is not validor is validbut is currentlyon the disk.
The page-table entry for a page that is brought into the memory is set as usual, butthe 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-faulttrap.
3/16/2011 33
-
8/7/2019 TYBsc Comp Sci
34/81
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
1. Page table: This table has the ability to mark an entry invalid through a valid-invalid bit.2. 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.
3/16/2011 34
-
8/7/2019 TYBsc Comp Sci
35/81
Explain pagereplacement
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 ReplacementAlgorithm:
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.
3/16/2011 35
-
8/7/2019 TYBsc Comp Sci
36/81
Whataredifferentpagereplacementalgorithms
1. FIFO Page Replacement:
2. Optimal Page Replacement
3. Least Recently Used Page Replacement:
3/16/2011 36
-
8/7/2019 TYBsc Comp Sci
37/81
BeladyAnomaly
3/16/2011 37
-
8/7/2019 TYBsc Comp Sci
38/81
END OF CHAPTER
-
8/7/2019 TYBsc Comp Sci
39/81
FILE MANAGEMENT
3/16/2011 39
-
8/7/2019 TYBsc Comp Sci
40/81
3/16/2011 40
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.
-
8/7/2019 TYBsc Comp Sci
41/81
3/16/2011 41
Explain thedifferenttypes ofaccess methods?
SequentialAccess:
DirectAccess:
OtherAccess Methods:
-
8/7/2019 TYBsc Comp Sci
42/81
3/16/2011 42
Explain thedifferentdirectory structures?
Single Level Directory:
-
8/7/2019 TYBsc Comp Sci
43/81
3/16/2011 43
Two Level Directory:
Note: Tree Structure Directories:
-
8/7/2019 TYBsc Comp Sci
44/81
3/16/2011 44
AcyclicGraph Directories:
-
8/7/2019 TYBsc Comp Sci
45/81
3/16/2011 45
Explain the file system structure?
Application programs
LOGICAL FILE SYSTEM
FILE ORGANIZATION MODULE
BASIC FILE SYSTEM
I / O Control
DEVICES
-
8/7/2019 TYBsc Comp Sci
46/81
3/16/2011 46
Writea 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.
-
8/7/2019 TYBsc Comp Sci
47/81
3/16/2011 47
Explain thedifferenttypes ofallocation methods?
Contiguous AllocationIt 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 contiguousallocation.
Disadvantages:
1. Finding space f
or a new fi
le.2. External fragmentation
-
8/7/2019 TYBsc Comp Sci
48/81
3/16/2011 48
LinkedAllocation
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:
1. Effectively only for sequential access files.
2. Space required for pointers.
3. Reliability.
-
8/7/2019 TYBsc Comp Sci
49/81
3/16/2011 49
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.
-
8/7/2019 TYBsc Comp Sci
50/81
3/16/2011 50
FREE SPACE MANAGEMENT
-
8/7/2019 TYBsc Comp Sci
51/81
3/16/2011 51
BitVector:
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.
Linkedlist:
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 substantialI/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.
-
8/7/2019 TYBsc Comp Sci
52/81
END OF CHAPTER
-
8/7/2019 TYBsc Comp Sci
53/81
3/16/2011 53
DISK SCHEDULING
-
8/7/2019 TYBsc Comp Sci
54/81
3/16/2011 54
Disk Scheduling
The seek time is the time for the disk arm to move the heads to the cylinder containingthe desired sector.
The rotationallatency 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.
-
8/7/2019 TYBsc Comp Sci
55/81
3/16/2011 55
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,183Total : 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.
-
8/7/2019 TYBsc Comp Sci
56/81
3/16/2011 56
CPU SCHEDULING
-
8/7/2019 TYBsc Comp Sci
57/81
3/16/2011 57
Scheduling Criteria
CPU utilization keep the CPU as busy as possible
1. Throughput # of processes that complete their execution per
time unit2. 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 requestwas submitted until the first response is produced, not output
(for time-sharing environment)
-
8/7/2019 TYBsc Comp Sci
58/81
3/16/2011 58
First Come First Served
Process Burst Time
P1
24
P2 3
P3
3
Suppose that the processes arrive in the order: P1 , P2 , P3The Gantt Chart for the schedule is:
Waiting time for P1
= 0; P2 = 24; P3= 27
Average waiting time: (0 + 24 + 27)/3 = 17
P1 P2 P3
24 27 300
-
8/7/2019 TYBsc Comp Sci
59/81
3/16/2011 59
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.
-
8/7/2019 TYBsc Comp Sci
60/81
3/16/2011 60
Example of Non-Preemptive SJF
Process Arrival Time Burst TimeP1
0.0 7
P2 2.0 4
P3
4.0 1
P4
5.0 4
SJF (non-preemptive)
Average waiting time = (0 + 6 + 3 + 7)/4 =4
P1 P3 P2
73 160
P4
8 12
-
8/7/2019 TYBsc Comp Sci
61/81
3/16/2011 61
Process Arrival Time Burst TimeP1
0.0 7
P2 2.0 4
P3
4.0 1
P4
5.0 4
SJF (preemptive)
Average waiting time = (9 + 1 + 0 +2)/4 = 3
P1 P3P2
42 110
P4
5 7
P2 P1
16
Example of Preemptive SJF
-
8/7/2019 TYBsc Comp Sci
62/81
3/16/2011 62
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.
-
8/7/2019 TYBsc Comp Sci
63/81
3/16/2011 63
Process Burst Time
P1
53
P2 17
P3
68
P4 24The Gantt chart is:
Typically, higher average turnaround than SJF, but better response.
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
0 20 37 57 77 97 117 121 134 154 162
Example of RR with Time Quantum = 20
-
8/7/2019 TYBsc Comp Sci
64/81
3/16/2011 64
Multi Level Queue Scheduling
-
8/7/2019 TYBsc Comp Sci
65/81
3/16/2011 65
Assignment:
01.
02.
Note: Assume quantum = 1 unit for RR Algorithm
PROCESS ARRIVAL TIME BURST TIME
P1 0.0 8P2 0.4 4
P3 1.0 1
PROCESS BURST TIME PRIORITY
P1 10 3
P2 1 1
P3 2 3P4 1 4
P5 5 2
-
8/7/2019 TYBsc Comp Sci
66/81
3/16/2011 66
END OF OPERATING SYSTEM
-
8/7/2019 TYBsc Comp Sci
67/81
JAVA SCRIPT
-
8/7/2019 TYBsc Comp Sci
68/81
3/16/2011 BY PROF YK 68
What is the Document ObjectModel?
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 thatprocessing can be incorporated back into the presented page.
-
8/7/2019 TYBsc Comp Sci
69/81
3/16/2011 BY PROF YK 69
-
8/7/2019 TYBsc Comp Sci
70/81
3/16/2011 BY PROF YK 70
Window Object
1. The Window object is the top level object in theJavaScript hierarchy.
2. The Window object represents a browser window.
3. A Window object is created automatically with every
instance of a or tag.
-
8/7/2019 TYBsc Comp Sci
71/81
Window ObjectMethods
3/16/2011 BY PROF YK 71
Method Description
-
8/7/2019 TYBsc Comp Sci
72/81
3/16/2011 BY PROF YK 72
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
milliseconds
-
8/7/2019 TYBsc Comp Sci
73/81
Window Object Properties
3/16/2011 BY PROF YK 73
Property Description
-
8/7/2019 TYBsc Comp Sci
74/81
3/16/2011 BY PROF YK 74
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
-
8/7/2019 TYBsc Comp Sci
75/81
3/16/2011 BY PROF YK 75
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 browserwindow.
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()L
oads the next URL
in the history listgo() Loads a specific page in the history list
-
8/7/2019 TYBsc Comp Sci
76/81
EVENTS
3/16/2011 BY PROF YK 76
i f
-
8/7/2019 TYBsc Comp Sci
77/81
3/16/2011 BY PROF YK 77
Properties of Event:
Property Description
Current Target The node at which the event is beingcurrently 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 itthat can be cancelled with the
prevent_default() method.
-
8/7/2019 TYBsc Comp Sci
78/81
INTERNET EXPLORER EVENT MODEL
3/16/2011 BY PROF YK 78
-
8/7/2019 TYBsc Comp Sci
79/81
3/16/2011 BY PROF YK 79
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.
For multiple buttons we add up the
values.
Client X , Client Y These integers specify the mouse
coordinates at the time of the event,
relative to the upper left corner.
Integer Meaning
1 Left button
2 Right button
4 Middle button
CONTD
-
8/7/2019 TYBsc Comp Sci
80/81
3/16/2011 BY PROF YK 80
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.
-
8/7/2019 TYBsc Comp Sci
81/81
END OF JAV
A SCRIPT