Showing posts with label lab. Show all posts
Showing posts with label lab. Show all posts

C Program to Simulate Round Robin CPU Sceduling Algorithm

The round robin CPU scheduling algorithm is simulated using C program. The time slice or time quantum is read from the user.

Program:

#include<stdio.h>
struct process{

Simulation of FCFS CPU Scheduling Algorithm in C

This is a C program to simulate First come first served (FCFS) CPU scheduling algorithm. First come first served algorithm serves each processes (or jobs) in the order of arrival. The process with lowest arrival time is executed first.

Program:
#include<stdio.h>
struct process
{
int burst,wait;
}p[20]={0,0};

C Program to Simulate grep Command in Linux

This post contains C program to simulate grep command in Linux or Unix operating systems

Simulation of  grep command in Linux

#include<stdio.h>
#include<string.h>
main()
{

C Program to Simulate the ls Command in Linux Operating system

This is a c program to do Simulation of ls Command in linux. The ls command lists all the contents of the directory including filse and sub-directories. The following program in C language will simulate the ls command.

#include<stdio.h>
#include<dirent.h>
main()
{

C Program to Remove (Delete) a Directory using LINUX System Calls

This is a C program to delete  or remove a directory using the system calls in Linux or Unix operating systems. The program make use of the remove() system call in Linux.

#include<stdio.h>
#include<fcntl.h>
main()
{

C Program to open, read and write files and perform file copy operation usingSystem Calls in UNIX

Write a program to open, read and write files and perform file copy operation. This program show how to open, read, write and copy files using Linux or Unix system calls like open(), read() and write().

#include<stdio.h>
#include<fcntl.h>
main()
{

C Program to Open, Read and Write a file using System Calls

This is a C program to open , read and write files using system calls in Linux (UNIX) operating systems. The system calls open(), read() and write() are used in the C program to open, read and write files in Unix/Linux operating systems.

#include<stdio.h>
#include<fcntl.h>
main()
{

Using System calls in C Program to rename a Directory in Linux

C Program to rename a directory in Unix or Linux operating systems using system call rename().

#include<stdio.h>
main()
{

How to Create process and display Process ID (pid) of Both Parent and Child

This program shows how to create process and display Process ID (pid) of Both Parent and Child processes. The process is created using the fork system call in UNIX (Linux) operating systems.

#include<stdio.h>
#include<dirent.h>
main(int argc,char **argv)
{

How to use fork and exec System Call

Using fork and exec System calls in Linux (UNIX) operating systems. Fork system call is used to create a child process from a parent process.
#include<stdio.h>
main()
{

How to use exit() System call

C program to show how to use exit system call. The function exit() is used to exit from a process (or to terminate a process). This works both in Linux or UNIX and Windows operating systems.

#include<stdio.h>
main()
{

C Program to Display and Set System Time and Date Using 8086 Interrupts

This is a C Program to Display and Set System Time and Date Using 8086 Interrupts. Interrupt number 21 (in hexadecimal) is used to:
C program to get system time and date and also to set it using 8086 interrupt INT 21 interrupt 0x21 21h int86() function call interrupts in C program
Output of c Program to get and set system time and date 

  • Get System time
  • Set System time
  • Get System Date
  • Set System Date
To Get system date:
- Call interrupt 0x21 (hexadecimal) 
- AH (higher byte of accumulator) should be made equal to 2A (hex) before calling interrupt
Output:

Half Adder and Full Adder : Logic Design Lab Experiments

Aim:
1. To design and set up a half adder using

  • (a) XOR gates and NAND gates
  • (b) NAND gates only

2. To clesign and set up a full adder using

  • (a) XOR gates and NAND gates
  • (b) NAND gates only

C Program to Calculate Determinant of Matrix of Order Upto 3

In this post i am sharing a C program to calculate determinant of matrices of order upto 3 (3x3).

#include<stdio.h>


void main()

{int a[10][10],i,m,j;

int det=0; 

printf("\nEnter the order of matrix:\n "); 

scanf("%i",&m);

printf("\nenter elements\n");

for(i=0;i<m;i++)

{
for(j=0;j<m;j++)
scanf("%d",&a[i][j]); }

printf("\nThe matrix is\n");

for(i=0;i<m;i++)

{
printf("\n");

for(j=0;j<m;j++)
printf("%3d",a[i][j]);

}

printf("\nthe transpose is\n");

for(i=0;i<m;i++)
{
for(j=0;j<m;j++)

printf("%3i",a[j][i]);

printf("\n");

}

if(m==1)

{
det=a[0][0];

printf("det=%i",det);

}