Posts

Write a multi-class multithreaded program that simulates multiple sleeping barbers, all in one barbershop that has a finite number of chairs in the waiting room. Each customer is instantiated from a single customer class; each barber is instantiated from a single Barber class.

import java.util.concurrent.*; public class SleepingBarber extends Thread {             public static Semaphore customers = new Semaphore(0);                  public static Semaphore barber = new Semaphore(0);             public static Semaphore accessSeats = new Semaphore(1);             /*  the number of chairs in this barbershop is 5. */             public static final int CHAIRS = 5;             public static int numberOfFreeSeats = CHAIRS;             /* THE CUSTOMER THREAD */             class Custo...

Design and Develop a program to implement lazy buddy system algorithm.

#include<stdio.h> #include<stdlib.h> int tree[2050], i, j, k; void segmentalloc(int, int), makedivided(int), makefree(int), printing(int, int); int place(int), power(int, int); int main() {             int totsize, ch, req;             printf("BUDDY SYSTEM REQUIREMENTS");             printf("\n Enter the Size of the memory  :  ");             scanf("%d", &totsize);                         while(1)             {                       ...