Operating systems, Uncategorized

Write a program to demonstrate Reader-Writer problem with reader priority.

  /* Write a program to demonstrate Reader-Writer problem with reader priority.*/ Theory There is a shared resource which should be accessed by multiple processes. There are two types of processes in this context. They are reader and writer. Any number of readers can read from the shared resource simultaneously, but only one writer can… Continue reading Write a program to demonstrate Reader-Writer problem with reader priority.

Advertisements
Operating systems, Uncategorized

Implement a solution for producer-consumer problem with counting semaphores and mutex.

/*Implement a solution for producer-consumer problem with counting semaphores and mutex.*/ Theory Producer-Consumer The producer’s job is to generate data, put it into the buffer, and start again. At the same time, the consumer is consuming the data (i.e., removing it from the buffer), one piece at a time. The problem is to make sure… Continue reading Implement a solution for producer-consumer problem with counting semaphores and mutex.

Operating systems, Uncategorized

Implement matrix multiplication using multithreading. Application should make use of pthread create, pthread join, pthread exit

    /*Implement matrix multiplication using multithreading. Application should make use of pthread create, pthread join, pthread exit. Program should also • Collect the returned value in main function using pthread join() • Display sum of row column multiplication by main thread (main func- tion).*/ Theory Thread of execution is the smallest sequence of programmed… Continue reading Implement matrix multiplication using multithreading. Application should make use of pthread create, pthread join, pthread exit

Operating systems, Uncategorized

The demonstration of fork, and wait system calls along with zombie and orphan states

Theory System call fork() is used to create processes. It takes no arguments and returns a process ID. The purpose of fork() is to create a new process, which becomes the child process of the caller. After a new child process is created, both processes will execute the next instruction following the fork() system call.… Continue reading The demonstration of fork, and wait system calls along with zombie and orphan states

Programs, Uncategorized

C Program to draw star pattern

#include<stdio.h> int main() { int i, j; for(i=1; i<=5; i++) { for(j=5; j>i; j--) { printf(" "); } printf("*"); for(j=1; j<(i-1)*2; j++) { printf(" "); } if(i==1) printf("\n"); else printf("*\n"); } for(i=4; i>=1; i--) { for(j=5; j>i; j--) { printf(" "); } printf("*"); for(j=1; j<(i-1)*2; j++) { printf(" "); } if(i==1) printf("\n"); else printf("*\n"); }… Continue reading C Program to draw star pattern