Você está na página 1de 12

Assignments for

Operating Systems and Web Technologies

Assignment 1: Paging and Page Replacement algorithms

Problem:

a) A computer uses an 18-bit address system, with 6 bits used as a page address and
12 bits used as a displacement. Calculate the total number of pages and express the
following addresses as a paging address:
001111000000111000

Ans:
Number of pages = 26 = 64.

b) In a paged segmented system, a virtual address consists of 32 bits of which 12 bits


are for displacement, 11 bits are for sequence number and 9 bits are for page
number. Calculate:
I. Page Size
II. Maximum Segment Size
III. Maximum Number of Pages
IV. Maximum number of segments

Ans:
I. Page Size = 212 = 4096
II. Maximum Segment Size = 29 = 512
III. Maximum Number of Pages = 211(29-1)
IV. Maximum Number of Segments = 211 = 2048

c) Assume a virtual paging system has three real page frames. Simulate the effect of
LRU, FIFO and optimal policies for page replacement for the following sequence of
virtual page references, indicating the position of page faults.
Sequence: 1 3 3 2 5 4 5 4 1 4 2 2 5

Ans:

LRU
1 3 3 2 5 4 1 4 2 2 5
1 1 1 5 5 5 2 2
3 3 3 4 4 4 4
2 2 2 1 1 5

Total Number of Page Faults = 8


FIFO
1 3 3 2 5 4 1 4 2 2 5
1 1 1 5 5 5 2 2
3 3 3 4 4 4 5
2 2 2 1 1 1

Total Number of Page Faults = 8

Optimal Algorithm
1 3 3 2 5 4 1 4 2 2 5
1 1 1 1 1 2
3 3 5 5 5
2 2 4 4

Total Number of Page Faults = 6

d) A computer has four page frames. The time of loading, time of last access, and the
R (Read) and M (Modified) bits for each page are as shown below:
Page Loaded Last Ref R M
0 26 280 1 0
1 230 265 0 01
2 140 270 0 0
3 110 285 1 1
I. Which page will NRU replace?
II. Which page will FIFO replace?
III. Which page will LRU replace?

Ans:

I. NRU algorithm will replace page = Page 2


II. FIFO algorithm will replace page = Page 3
III. LRU algorithm will replace page = Page 1
Assignment 2: Process Scheduling

Problem:

a) What kind of data structure is required to implement the round robin scheduling
policy?
Ans:

Round-Robin scheduling algorithm uses FIFO policy, which is nothing but the queue data
structure.

b) List the advantages and disadvantages of round robin scheduling if the time slice
is too large.
Ans:

Advantages:
I. Not too Context -Switches required
II. Turnaround time will be less.

Disadvantage:
I. If quantum is too large Round-Robin Policy will become FIFO.
II.

c) Find the average waiting time in the round robin scheduling for the following.
Assume a time slice of 5ms.
Process CPU time (in ms)
P1 4
P2 3
P3 3

Ans:

Following diagram shows the Gantt chart for the Round Robin Algorithm with time slice
of 5ms:

P1 P2 P3
0 4. 7 10

Waiting time (p1) = Completion time (P1) – CPU time (P1) = 4 – 4 = 0


Waiting time (p2) = Completion time (P2) – CPU time (P2) = 7 – 3 = 4
Waiting time (p2) = Completion time (P3) – CPU time (P3) = 10 – 3 = 7

Hence the average waiting time = (0 + 4 + 7)/3


= 11/3
=3.67 ms
Assignment 3: Client server concepts

Problem:

a) How does the system’s performance change with respect to response time when
more (user) terminals are added to
a) Host-centric computing (for example Mainframes)
b) Network of computers.
Which is better and why?
Ans:

1.Performance of Host-Centric computing (Mainframes) degrades as more and more


terminals get attached while in Network OS due to abstraction terminals are attached
with ease.

2. There is one smart server present in mainframe systems but in netwok of computers
each terminal is thick and smart.

3. When crash occurs mainframe has no other option but in network of computers server
can be switched from one terminal to another or replica can be maintained.

b) List out the applications which are based on RPC & P2P,
ODBC middleware.
Ans:

Middleware Application

RPC Distributed Applications


P2P Instant Massenger,Grid Computing
ODBC Databases
Assignment 4: Networking, IP addressing and Subnetting

Problem:

a) Complete the following table given below:

Use of Repeaters Connects two segments of a network cable.


It retimes and regenerates the signals to proper
amplitudes and sends them to the other segments.

Repeaters operate at which Physical Layer


layer of OSI
Bridges are used for Traffic Filter, Checks the address of
source/destination and relays the
packets
Bridges operate at which Data Link Layer
layer of OSI
Routers are used for Route data packets between two networks,
Optimal Path Selection
Routers operate at which Network Layer
layer of OSI

b) Complete the following table given below.


Function OSI Layer TCP/IP Layer
Routing of Network Layer Internet Layer
messages from
source to
destination
Transmission of Physical Layer Network Access Layer
bits
Node to Node Data Link Layer Network Access Layer
delivery of
messages
End to End Transport Layer Transport Layer
delivery of
messages
Error and Flow Data Link Layer Network Access Layer
Control
Dialogue control Session Layer Application Layer
c) Complete the table given below.
IP Address IP Default Network Host
Class subnet mask address address
215.26.50. C 255.255.255.0 215.26.50.0 12
12
122.12.25. A 255.0.0.0 122.0.0.0 12.25.11
11
150.5.5.22 B 255.255.0.0 150.5.0.0 5.22
192.168.20 C 255.255.255.0 192.168.20.0 2
.2
172.12.45. B 255.255.0.0 172.12.0.0 45.3
3

d) Global Inc Company obtains a class C address of


190.150.20.0. The company
requirements of dividing the physical network into 4 subnets
interconnected by routers. Each subnet requires at least 30
Hosts.
I. Determine the number of bits to be borrowed from the host
portion of the IP
address.
II. Determine the number of bits left for the host addresses

Ans:

Class C address 190.150.20.0 into 4 subnets :


I. Borrow 3 bits from the Host part of the IP address
(N.N.N.H 10111110.10010110.00010100.00000000)

• 23 – 2 = 6
• There are in fact 8 subnet address, but only 6 of them are usable
• BINARY to DECIMAL
– 000 Cannot use
– 001 32
– 010 64
– 011 96
– 100 128
– 101 160
– 110 192
– 111 Cannot use

190.150.20.32, 190.150.20.64, 190.150.20.96, 190.150.20.128, 190.150.20.160,


190.150.20.192
II. Number of bits left for the host address = 5
Assignment 5: WWW

Problem:

a) Consider the URLs:

http://www.eip.hexaware.com/schdule.html
ftp://www.unisys.hexaware.com:8091/books/java.doc

Identify the following:


I. Host Name
II. Port Number
III. Resource name
IV. Protocol name

Ans:

http://www.eip.hexaware.com/schdule.html

I. Host Name = eip.hexaware.com


II. Port Number = 80
III. Resource Name = schedule.html
IV. Protocol Name = http

ftp://www.unisys.hexaware.com: 8091/books/java.doc

I. Host Name = unisys.hexaware.com


II. Port Number = 8091
III. Resource Name = java.doc
IV. Protocol Name = ftp
b) List the difference between HTTP GET and HTTP POST methods.

HTTP GET method


 Parameters are encoded and passed along with the URL
 URL encoding
 In web usually, parameters are passed as name-value pairs
 Example:
http://shopping/purchase?ItemName=CD&Quantity=10
HTTP POST method
 The parameters from the browser are passed as part of the Message
body
 Typically the CGI program receives the message body through STDIN
and decodes it
 Example:
POST /shopping/purchase HTTP/1.0
User_Agent: Mozilla/3.0 Gold
Accept: text/plain
Accept: text/html
ItemName=CD+Quantity=10

c) Why is dynamic web content response time slower than static web
content?
Ans:

In Static web content


 Content created as collection of web documents (HTML files)
 Author determines the content at the time of creation
 Each request will return exactly the same data (Content doesn’t change)
 Example: HTML files, gif/jpeg files – Home page of yahoo

But in Dynamic web content


 Created on the fly by a web server upon a request to reflect the current info
 Content may vary for each request
 Example: A typical web application (Banking etc) – online ticket status page

Thus since dynamic web content is not fixed like static web content,
lots of processing is done to take current data from web server
hence dynamic web content is slower.

d) An entrepreneur starts a small software company with a


network infrastructure
consisting of 20 hosts with a cable modem internet access. The
entrepreneur wants to implement security policy for the
network and the network should be protected from the
security attacks from the outside world. If you have been a
security consultant, what security solution you would provide
at first hand?

Ans:

When a computer is connected to a public network, all the data transmitted through the
Internet are exposed to the outside world

Firewall is the best mechanism to use


Firewall is a system designed to prevent unauthorized access to or from a private
network.

 It can be implemented in both hardware and software.

Firewall is Frequently used to prevent unauthorized Internet users from accessing


private networks connected to the Internet, especially Intranets

 All messages entering or leaving the intranet pass through the firewall
Messages are examined and those that do not meet the specified security criteria are
blocked

----------------

Você também pode gostar