Month: September 2014

Modern Operating System

Posted on

Page Replacement Algorithms  

 FIFO Algorithm

The simplest page-replacement algorithm is a FIFO algorithm.

A FIFO replacement algorithm associates with each page the time when that page was brought into memory. When a page must be replaced, the oldest page is chosen. We can create a FIFO queue to hold all pages in memory.

The first three references (7, 0, 1) cause page faults, and are brought into these empty frames. The next reference (2) replaces page 7, because page 7 was brought in first. Since 0 is the next reference and 0 is already in memory, we have no fault for this reference.

The first reference to 3 results in replacement of page 0, since it is now first in line. Because of this replacement, the next reference, to 0, will fault. Page 1 is then replaced by page 0. This process continues as shown in Figure. Every time a fault occurs, we show which pages are in our three frames. There are fifteen faults altogether.

Reference string

1

Fig: FIFO Page-replacement algorithm

Number of page faults=15

Optimal Algorithm

An optimal page-replacement algorithm has the lowest page fault rate of all algorithms. An optimal page -replacement algorithm exists, and has been called OPT or MIN. It will simply replace the page that will not be used for the longest period of time.

Reference String

2

fig: optimal Algorithm

Number of page faults=9

Now consider the same string with 3 empty frames. The reference to page2 replaces page 7, because 7 will not be used until reference 18, whereas page 0 will be used at 5, and page 1 at 14. The reference to page 3 replaces page 1, as page 1 will  be  the  last  of  the  three  pages  in  memory  to  be  referenced again. Optimal replacement is much better than a FIFO.

The  optimal  page-replacement  algorithm  is  difficult  to implement,  because  it  requires  future  knowledge  of  the  reference string.

LRU Algorithm (Least Recently Used)

The FIFO algorithm uses the time when a page was brought into memory; the OPT algorithm uses the time when a page is to be used.  In  LRU  replace  the  page  that  has  not  been  used  for  the longest period of time.

LRU replacement associates with each page the time of that page’s last use. When a page must be replaced, LRU chooses that page that has not been used for the longest period of time.

Reference String

3

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Advertisements

Linux Administration

Posted on

How to Setup sendmail server on red hat linux

Email Delivery Process :

  • Mail User Agent (MUA)
  1. To be able to send mail, you, or your users, need a program called a Mail User Agent (MUA). The MUA, also called a mail client, enables users to write and read mail messages.
  1. Two types of MUAs are available: a graphical user interface (GUI), such as Netscape Messenger, and a command-line interface, such as Pine.
  • Mail Transfer Agent (MTA)
  1. Whether your MUA is a GUI or command-line interface, after the message is composed, the MUA sends it to the mail transfer agent (MTA).
  1. The MTA is the program that sends the message out across the network and does its work without any intervention by the user.
  • The MTA installed by default on your Red Hat system is called Sendmail.
  1. The MTA reads the information in the To section of the e-mail message and determines the IP address of the recipient’s mail server.
  1. Then the MTA tries to open a connection to the recipient’s server through a communication port, typically port 25.
  1. If the MTA on the sending machine can establish a connection, it sends the message to the MTA on the recipient’s server using the Simple Message Transfer Protocol (SMTP).
  • Local Delivery Agent (LDA)
  1. After the LDA receives the message from the MTA, it places the message in the receiver’s mailbox file that is identified by the username.
  1. On your Red Hat system this is a program called procmail. The location of the user’s mailbox file is
    /usr/ spool/mail/<user’s name>.
  • The final step in the process happens when the user who is the intended receiver of the message reads the message. The user does this using the MUA on his or her PC.
  • Mail Notifier
  • An optional program is a mail notifier that periodically checks your mailbox file for new mail. If you have such a program installed, it notifies you of the new mail.
  • If new mail has arrived, the shell displays a message just before it displays the next system prompt. It won’t interrupt a program you’re running.
  • You can adjust how frequently the mail notifier checks and even which mailbox files to watch.
  • If you are using a GUI, there are mail notifiers available that play sounds or display pictures to let you know that new mail has arrived.
  • Configuring Sendmail:

3

4

2

Now send mail from user kiranmail to clientmail

Command is:

3

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Javascript for handling events in javascript

Posted on

Javascript to implement onblur and onfocus event.

<!DOCTYPE html>

<html>

<body>

<p>When you enter the input field, a function is triggered which sets the background color to yellow. When you leave the input field, a function is triggered which sets the background color to red.</p>

Enter your name: <input type=”text” id=”myInput” onfocus=”focusFunction()” onblur=”blurFunction()”>

<script>

// Focus = Changes the background color of input to yellow

function focusFunction() {

document.getElementById(“myInput”).style.background = “yellow”;

}

// No focus = Changes the background color of input to red

function blurFunction() {

document.getElementById(“myInput”).style.background = “red”;

}

</script>

</body>

</html>

Output:

1

2

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Linux Administration

Posted on

1

To check package is installed or not the command is:

2

3

4

1

2

2

1

3

4

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Modern Operating System

Posted on

LOGICAL VERSUS PHYSICAL ADDRESS SPACE

An address generated by the CPU is commonly referred to as a logical address, whereas an address seen by the memory unit is commonly referred to as a physical address.

The  compile-time  and  load-time  address-binding  schemes result in an environment where the logical and physical addresses are the same. The execution-time address-binding scheme results in an environment where the logical and physical addresses differ, in  this  case,  we  usually  refer  to  the  logical  address  as  a  virtual address. The set of all logical addresses generated by a program is referred  to  as  a  logical  address  space; 

the  set  of  all  physical addresses corresponding to these logical addresses is referred to as a physical address space.

2

Fig: DYNAMIC RELOCATION USING RELOCATION REGISTER

The  run-time  mapping  from  virtual  to  physical  addresses  is done by the memory-management unit (MMU), which is a hardware device.

The base register is called a relocation register. The value in the  relocation  register  is  added  to  every  address  generated  by  a user process at the time it is sent to memory. For example, if the base is at 13000, then an attempt by the user to address location 0 dynamically relocated to location 13,000; an access to location 347 is  mapped  to  location  13347.  The  MS -DOS  operating  system running on the Intel 80×86 family of processors uses four relocation registers when loading and running processes.

The  user  program  never  sees  the  real  physical  addresses. The program can create a pointer to location 347 store it memory, manipulate it, compare it to other addresses —all as the number 347.

The user program deals with logical addresses. The memorymapping  hardware  converts  logical  addresses  into  physical addresses.

Logical  addresses  (in  the  range  0  to  max)  and  physical addresses (in the range R + 0 to R + max for a base value R). The user generates only logical addresses.

The  concept  of  a  logical  address  space  that  is  bound  to a separate  physical  address  space  is  central  to  proper  memory management.

SWAPPING:

A  process  can  be  swapped  temporarily  out  of  memory  to  a backing  store,  and  then  brought  back  into  memory  for  continued execution. Assume a multiprogramming environment with a round robin  CPU-scheduling  algorithm.

When  a  quantum  expires,  the memory  manager  will  start  to  swap  out  the  process  that  just finished, and to swap in another process to the memory space that has been freed.  When each process finishes its quantum, it will be swapped with another process.

3

Fig: SWAPPING OF TWO PROCESSES USING A DISK AND A BACKING STORE

A  variant  of  this  swapping  policy  is  used  for  priority-based scheduling algorithms. If a higher-priority process arrives and wants service, the  memory  manager  can  swap  out  the  lower-priority process so that it can load and execute the higher-priority process.

When the higher priority process finishes, the lower-priority process can be swapped back in and continued. This variant of swap ping is sometimes called rollout, roll in.

A process swapped out will be swapped back into the same memory  space  that  it  occupies  previously.  If  binding  is  done  at assembly  or  load  time,  then  the  process  cannot  be  moved  to different location. If execution-time binding is being used, then it is possible to swap a process into a different memory space.

Swapping  requires  a  backing  store.  The  backing  store  is commonly a fast disk. It is large enough to accommodate copies of all  memory  images  for  all  users. The  system  maintains  a  ready queue  consisting  of  all  processes  whose  memory  images  are  on the backing store or in memory and are ready to run.

Memory Allocation or Contiguous memory allocation

Main memory usually has two partitions

  Low Memory — Operating system resides in this memory.

  High Memory — User processes then held in high memory.

Operating system uses the following memory allocation mechanism

4

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Javascript for handling events in javascript

Posted on

  • Onclick event:

 

<html>

                <head>

                                <title>                                  on click

                                </title>

                </head>

                                <script type=”text/javascript” language=”javascript”>

 

     function findper(totalmarks1)

{

                if(totalmarks1<=300)

                                document.write(“perc=”+(totalmarks1/3)+”%”);

}

                </script>

                <body>

                <center>

                                <form id=”myform”>

                                enter toal marks: <input type=”text” id=”totalmarks” >

                                <input type=”button” id=percentage” value=”per”       

                                                                                    onclick=”findper(myform.totalmarks.value)”>

                           </form>

                </center>

                </body>

</html>

1

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

DSP Sample Questions :

Posted on

TEST-1

  1. Answer any five of the followings

a). Determine whether or not the following signal is periodic or not. In case a signal is periodic, specify its fundamental period.

x (n)=2exp[j(n/6-)]

b).Determine the response of the system

y (n)=y(n-1)- y(n-2)+x(n)

To the input signal x (n) = (n)-(n-1)

c). Consider a causal LTI system whose system function is

H (z) =

Draw the signal flow graph for implementation of the system in parallel form using first and second order direct form-II sections.

d). Determine the pole-zero plot for the signal

x (n) =

Where a>0, and M=8

e). x(n)={a,b,c,1,o,1,c,b}.Find the sequence of x(k) ?

f). State and explain windowing theorem of discrete time Fourier Transform.

  1. 2. a). Obtain the autocorrelation of the D.T sequence given below and sketch the result.

x (n)=u(n),0< <1

b). Determine the Inverse z-Transform of X (z) =

if   i). ROC: |z|>1

ii).ROC:|z|<0.5

iii).ROC:0.5<|z|<1

  1. 3. a). An eight point sequence x1(n) is given by

x1(n)={1,2,3,4,5,6,7,8}

Find the DFT property of x1(n) using any of the FFT technique.

b). what is the difference between periodic convolution and circular convolution? Explain how linear convolution can be implemented by using circular convolution?

  1. Find the discrete Fourier Transform and energy density spectrum (EDS) of given DT signal.

x (n)-u(n),  -1<<1

  1. Explain the system classification tests for stability and causality, in time domain and Z-domain.
  2. Explain the geometrical method for an approximate sketching of frequency response function directly from the pole zero plots.
  3. Write notes on any four of the followings

a). DSP processors

b). Quantization effects in fixed-point FFT algorithm.

c). Block convolution using DFT by overlap-add method.

d). Relationship between DTFT, DFT and -Transform

e).System classification.

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com