Skip to content

debasishdash01/os-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS-Assignment

Table of contents

Introduction

  • Thread 2 having function to print 1 to 10 finishes before Thread 1 having function to print 10 to 20
  • Thread 1 finishes before Thread 3 having function to print 20 to 30
  • Use semaphore(s) to enforce these sychronization rules by adding P() and V() calls
  • Finally, you must include sem create calls in suitable places to create and initialize the semaphores.
  • Use sem create() calls show the intial semaphore value for each newly created semaphore.
  • Do not use any synchronization primitives or techniques other than sempahores.
  • code.c is the main file which achieve the goal. without_sem.c is used to illustrate the problem which arises when we don't use semaphores

Requirements

  • gcc compiler

Usage

For compilation

  • using semaphores
$ gcc code.c -lpthread
  • without using semaphores
$ gcc without_sem.c -lpthread

For execution

$ ./a.out

(Back to top)

License

Lovely Professional University

LinkedIn: Debasish Dash  · 

About

Assignment for Operating System

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages