Posts

Showing posts from 2017

MID 1 IMPORTANT QUESTIONS

UNIT-I What is an operating system? Describe the  Operating System functions Explain the Time- shared Operating System  Explain different categories of system calls with suitable example?  With a neat sketch, describe the services that an operating system provides to users, processes and other systems. What is the purpose of interrupts? What are the differences between a trap and an interrupt? Can traps be generated by a user program? Explain the purpose with an example. Explain briefly Layered Operating system structure with neat sketch. UNIT-II What is a process? Explain about various fields of Process Control Block.  Define a Thread? Give the benefits of multithreading. What resources are used when a thread is created? How do they differ from those used when a process is created?  Distinguish between preemptive and non-preemptive scheduling. Explain each type with an example.  What is IPC? Explain in detail the inter process commu...

Scheduling methods

Scheduling algorithms may use different criteria for selecting process from the ready list. In general,scheduling algorithm may be preemptive or nonpreemptive. Four circumstances are used for making scheduling decisions. 1. When a process switches from running state to the waiting state. 2. When a process switches from the running state to the ready state. 3. When a process switches from the waiting state to the ready state. 4. When a process terminates. Preemptive scheduling takes place for circumstances 2 and 3. Nonpreemptive scheduling takes place under circumstances 1 and 4. For 1 and 4 circumstances, scheduling is not possible and for remaining circumstance, scheduling is possible. In preemptive scheduling, a running process may be replaced by a higher priority process at any time. Preemptive scheduling is more responsive but it imposes higher overhead since each process rescheduling entails a complete process switch. In Nonpreemptive scheduling, once the CPU has been all...

MFT (Multi programming with Fixed no of Tasks)

#include<stdio.h> #include<conio.h> void main() { int m,p,s,p1; int m1[4],i,f,f1=0,f2=0,fra1,fra2,s1; clrscr(); printf("Enter the memory size:"); scanf("%d",&m); printf("Enter the no of partitions:"); scanf("%d",&p); s=m/p; printf("Each partn size is:%d",s); printf("\nEnter the no of processes:"); scanf("%d",&p1); for(i=0;i<p1;i++) { printf("\nEnter the memory req for process%d:",i+1); scanf("%d",&m1[i]); if(m1[i]<=s) { printf("\nProcess is allocated in partition%d",i+1); fra1=s-m1[i]; printf("\nInternal fragmentation for process is:%d",fra1); f1=f1+fra1; } else { printf("\nProcess not allocated in partition%d",i+1); s1=m1[i]-s; fra2=s-s1; f2=f2+fra2; printf("\nExternal fragmentation for partition is:%d",fra2); } } printf("\nProcess\tmemory\tallocatedmemory"); for(i=0;i<p1;i++) pr...

MVT(Multi[programming with Variable no of Tasks)

#include<stdio.h>  #include<conio.h>  void main()  {  int m=0,m1=0,m2=0,p,count=0,i;  clrscr();  printf("Enter the memory capacity:"); scanf("%d",&m); printf("Enter the no of processes:");  scanf("%d",&p); for(i=0;i<p;i++)  {  printf("\nEnter memory req for process%d: ",i+1);  scanf("%d",&m1); count=count+m1;  if(m1<=m)  {  if(count==m)  {  printf("There is no further memory remaining:");  }  else  {  printf("The memory allocated for process%d is: %d ",i+1,m);  m2=m-m1;  printf("\nRemaining memory is: %d",m2);  m=m2; }  }  else  {  printf("Memory is not allocated for process%d",i+1);  }  printf("\nExternal fragmentation for this process is:%d",m2);  }  getch();  }

ROUND ROBIN with Arrival Time

#include<stdio.h> #include<conio.h> void main() { int et[30],ts,n,i,x=0,tot=0; char pn[10][10]; clrscr(); printf("Enter the no of processes:"); scanf("%d",&n); printf("Enter the time quantum:"); scanf("%d",&ts); for(i=0;i<n;i++) { printf("enter process name & estimated time:"); scanf("%s %d",pn[i],&et[i]); } printf("The processes are:"); for(i=0;i<n;i++) printf("process %d: %s\n",i+1,pn[i]); for(i=0;i<n;i++) tot=tot+et[i]; while(x!=tot) { for(i=0;i<n;i++) { if(et[i]>ts) { x=x+ts; printf("\n %s -> %d",pn[i],ts); et[i]=et[i]-ts; } else if((et[i]<=ts)&&et[i]!=0) { x=x+et[i]; printf("\n %s -> %d",pn[i],et[i]); et[i]=0;} } } printf("\n Total Estimated Time:%d",x); getch(); } 

PRIORITY with Arrival Time

#include<stdio.h>  #include<conio.h>  #include<string.h>  void main()  {  int et[20],at[10],n,i,j,temp,p[10],st[10],ft[10],wt[10],ta[10];  int totwt=0,totta=0;  float awt,ata; char pn[10][10],t[10];  clrscr();  printf("Enter the number of process:");  scanf("%d",&n); for(i=0;i<n;i++)  {  printf("Enter process name,arrivaltime,execution time & priority:"); flushall();  scanf("%s%d%d%d",pn[i],&at[i],&et[i],&p[i]); }  for(i=0;i<n;i++)  for(j=0;j<n;j++)  {  if(p[i]<p[j]) {  temp=p[i]; p[i]=p[j]; p[j]=temp;  temp=at[i];  at[i]=at[j]; at[j]=temp; temp=et[i];  et[i]=et[j]; et[j]=temp; strcpy(t,pn[i]);  strcpy(pn[i],pn[j]);  strcpy(pn[j],t);  }  }  for(i=0;i<n;i++)  { if(i==0) { st[i]=at[i]; wt[i]=st[i]-at[i]; ft[i]=st[i]+et[i]; ta[i]=ft[i]-at[i]; } else { st[i]=ft[i-1]; wt[i]=st[i]-at[i]; ft[i]=st[i]+et...

SJF with Arrival Time

#include<stdio.h> #include<conio.h> #include<string.h> void main() { int et[20],at[10],n,i,j,temp,st[10],ft[10],wt[10],ta[10]; int totwt=0,totta=0; float awt,ata; char pn[10][10],t[10]; clrscr(); printf("Enter the number of process:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("Enter process name, arrival time & execution time:"); flushall(); scanf("%s%d%d",pn[i],&at[i],&et[i]); } for(i=0;i<n;i++) for(j=0;j<n;j++) { if(et[i]<et[j]) { temp=at[i]; at[i]=at[j]; at[j]=temp; temp=et[i]; et[i]=et[j]; et[j]=temp; strcpy(t,pn[i]); strcpy(pn[i],pn[j]); strcpy(pn[j],t); } } for(i=0;i<n;i++) { if(i==0) st[i]=at[i]; else st[i]=ft[i-1]; wt[i]=st[i]-at[i]; ft[i]=st[i]+et[i]; ta[i]=ft[i]-at[i]; totwt+=wt[i]; totta+=ta[i]; } awt=(float)totwt/n; ata=(float)totta/n; printf("\nPname\tarrivaltime\texecutiontime\twaitingtime\ttatime"); for(i=0;i<n;i++) printf("\n%s\t%5d\t\t%5d\t\t%5d\t\t%5d",pn...

FCFS with Arrival Time

#include<stdio.h>  #include<conio.h>  void main()  {  `char pn[10][10];  int arr[10],bur[10],star[10],finish[10],tat[10],wt[10],i,n;  int totwt=0,tottat=0;  clrscr();  printf("Enter the number of processes:");  scanf("%d",&n); for(i=0;i<n;i++)  {  printf("Enter the Process Name, Arrival Time & Burst Time:");  scanf("%s%d%d",&pn[i],&arr[i],&bur[i]);  }  for(i=0;i<n;i++)  {  if(i==0)  {  star[i]=arr[i]; wt[i]=star[i]-arr[i]; finish[i]=star[i]+bur[i]; tat[i]=finish[i]-arr[i];  }  else  {  star[i]=finish[i-1]; wt[i]=star[i]-arr[i]; finish[i]=star[i]+bur[i]; tat[i]=finish[i]-arr[i];  }  }  printf("\nPName Arrtime Burtime Start TAT Finish");&#0; for(i=0;i<n;i++)  {  printf("\n%s\t%6d\t\t%6d\t%6d\t%6d\t%6d",pn[i],arr[i],bur[i],star[i],tat[i],finish[i]);  totwt+=wt[i];  tottat+=tat[i];  }  printf(...

OPERATING SYSTEM SERVICES

An operating system provides an environment for the execution of programs. The specific services provided are differing from one operating system to another, but we can identify common classes. These operating system services are provided for the convenience of the programmer to make the programming task easy. Program creation: the operating system provides editors, debuggers, to assist the programmer in creating programs. Programs execution: A number of tasks required to execute a program, the tasks include instructions and data must be loaded into main memory, I/O devices and files must be initialized, and other resources must be prepared. The OS handles these tasks for the user. Input/Output operations: A running program may require input and output. This I/O may involve a file or an I/O device. A user program cannot execute I/O operations directly, the OS must provide some means to do so. Error detection: the operating system detects the different types of er...

operating system services

Image
An operating system provides an environment for the execution of programs. The specific services provided are differing from one operating system to another, but we can identify common classes. These operating system services are provided for the convenience of the programmer to make the programming task easy. Program creation: the operating system provides editors, debuggers, to assist the programmer in creating programs. Programs execution: A number of tasks required to execute a program, the tasks include instructions and data must be loaded into main memory, I/O devices and files must be initialized, and other resources must be prepared. The OS handles these tasks for the user. Input/Output operations: A running program may require input and output. This I/O may involve a file or an I/O device. A user program cannot execute I/O operations directly, the OS must provide some means to do so. Error detection: the operating system detects the different types of erro...

Assignment I

1. Explain the Dual-mode operation of an Opearting System. 2. With neat sketch, describe the services that an operaying system provides to users, processes and other system 3. Explain the difference between micro-kernel and macro-kernel. 4. What is system call? Explain the various types of system calls provided by an operating system

Round Robin Schudling Algorithm

#include<stdio.h> int main() {    int count,j,n,time,remain,flag=0,time_quantum;   int wait_time=0,turnaround_time=0,at[10],bt[10],rt[10];   printf("Enter Total Process:\t ");   scanf("%d",&n);   remain=n;   for(count=0;count<n;count++)   {     printf("Enter Arrival Time and Burst Time for Process Process Number %d :",count+1);     scanf("%d",&at[count]);     scanf("%d",&bt[count]);     rt[count]=bt[count];   }   printf("Enter Time Quantum:\t");   scanf("%d",&time_quantum);   printf("\n\nProcess\t|Turnaround Time|Waiting Time\n\n");   for(time=0,count=0;remain!=0;)   {     if(rt[count]<=time_quantum && rt[count]>0)     {       time+=rt[count];       rt[count]=0;       flag=1;   ...

Priority Schudling Algorithm

#include<stdio.h> int main() {     int bt[20],p[20],wt[20],tat[20],pr[20],i,j,n,total=0,pos,temp,avg_wt,avg_tat;     printf("Enter Total Number of Process:");     scanf("%d",&n);     printf("\nEnter Burst Time and Priority\n");     for(i=0;i<n;i++)     {         printf("\nP[%d]\n",i+1);         printf("Burst Time:");         scanf("%d",&bt[i]);         printf("Priority:");         scanf("%d",&pr[i]);         p[i]=i+1;           //contains process number     }     //sorting burst time, priority and process number in ascending order using selection sort     f...

Computer system and operating system overview

computer system and operating system overview   click here

Operating System R13 Syllabus

UNIT-I: Computer System and Operating System Overview:  Overview of computer operating systems, operating systems functions, protection and security, distributed systems, special purpose systems, operating systems structures and systems calls, operating systems generation. UNIT-II: Process Management Process concept process scheduling, operations, Inter process communication. Multi Thread programming models. Process scheduling criteria and algorithms, and their evaluation. UNIT-III: Concurrency : Process synchronization, the critical- section problem, Peterson’s Solution, synchronization Hardware, semaphores, classic problems of synchronization, monitors, Synchronization examples UNIT-IV: Memory Management: Swapping, contiguous memory allocation, paging, structure of the page table, segmentation Virtual Memory Management: virtual memory,  demand paging, page-Replacement, algorithms, Allocation of Frames, Thrashing UNIT-V: Principles o...

FCFS Scheduling Algorithm

FCFS program in c #include<stdio.h> int main() {     int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j;     printf("Enter total number of processes(maximum 20):");     scanf("%d",&n);     printf("\nEnter Process Burst Time\n");     for(i=0;i<n;i++)     {         printf("P[%d]:",i+1);         scanf("%d",&bt[i]);     }     wt[0]=0;    //waiting time for first process is 0     //calculating waiting time     for(i=1;i<n;i++)     {         wt[i]=0;         for(j=0;j<i;j++)             wt[i]+=bt[j];     }     printf("\nProcess\t\tBurst Time\tWai...

SJF Scheduling Algorithm

SJF programming in C #include<stdio.h> void main() {     int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp;     float avg_wt,avg_tat;     printf("Enter number of process:");     scanf("%d",&n);     printf("\nEnter Burst Time:\n");     for(i=0;i<n;i++)     {         printf("p%d:",i+1);         scanf("%d",&bt[i]);         p[i]=i+1;           //contains process number     }     //sorting burst time in ascending order using selection sort     for(i=0;i<n;i++)     {         pos=i;         for(j=i+1;j<n;j++)         { ...

Operating System Services

An operating system provides an environment for the execution of programs. The specific services provided are differing from one operating system to another, but we can identify common classes. These operating system services are provided for the convenience of the programmer to make the programming task easy. Program  Creation: the operating system provides editors, debuggers, to assist the programmer in creating programs. Programs Execution: A number of tasks required to execute a program, the tasks include instructions and data must be loaded into main memory, I/O devices and files must be initialized, and other resources must be prepared. The OS handles these tasks for the user. Input/Output Operations: A running program may require input and output. This I/O may involve a file or an I/O device. A user program cannot execute I/O operations directly, the OS must provide some means to do so. Error Detection: the operating system detects the different types of erro...

Operating System and structure of OS

 “An operating system is a program that acts as an intermediary between the user and the computer hardware and controls the execution of all kind of programs”        An operating system is a program that manages the computer hardware. It also provides a basic for application program and acts as an interface between the computer user and the computer hardware.     Operating systems for handheld computers are designed to provide an environment in which a user can easily interface with the computer to execute programs. Thus, some operating systems are designed to be convenient, others to be efficient , and others some combination of the two.      Because an operating system is large and complex, it must be created piece of piece. Each of these pieces should be a well-delineated portion of the system, with carefully defined inputs and outputs and functions. Linux, UNIX, Windows, OS X, VMS, OS/400, AIX, Z/OS, etc are the few...

Data Mining Short Questions

1.     Describe heterogeneous and legacy database? 2.     Describe about Object-oriented databases? 3.     Describe about object-relational databases? 4.     Describe about transactional database? 5.     What is cluster Analysis? 6.     What is Outlier Analysis? 7.     What is Association analysis? 8.     What is the difference between a data warehouse and data mart? 9.     What kind of data mining can be performed on spatial databases? 10. Describe how correlation coefficient is computed? 11. What is data reduction? What is dimensionality reduction? 12. Describe snowflake and fact constellations. 13. What is classification? Describe the need for classification. 14. Define a FP-Tree. 15. Write a note on hierarchical clustering? 16. What is data cleaning? 17. Describe holdout method? 18. What is a data ware...