Giter Site home page Giter Site logo

cse314-pthread-synchronization-offline's Introduction

CSE314 Operating Systems (Offline 4)

Problem Statement

Solution to Part A : Master-Worker Thread Pool

The solution code is in master-worker.c

To run the code, use the following command:

gcc master-worker.c -o master-worker.o -lpthread
./master-worker.o <number-of-items> <max-buffer-size> <number-of-worker> <number-of-producer>

Solution to Part B : Reader-Writer Problem

To test the code, use test-reader-pref.cpp.

To compile and run the code, use the following commands:

    g++ rwlock-reader-pref.cpp -o rwlock-reader-pref.o -lpthread
    ./rwlock-reader-pref.o <number-of-readers> <number-of-writers>

To test the code, use test-writer-pref.cpp

To compile and run the code, use the following commands:

    g++ rwlock-writer-pref.cpp -o rwlock-writer-pref.o -lpthread
    ./rwlock-writer-pref.o <number-of-readers> <number-of-writers>

Solution to Part C : Zemaphore

To test the code, use test-zem.c.

To compile and run the code, use the following commands:

    gcc zemaphore.c test-zem.c -o test-zem.o -lpthread
    ./test-zem.o

Solution to Part D : Server-Client-Database

Problem Statement:

There are multiple databases and one server. More than one client can connect to the server at a time and can request access to a database. The request will only be granted by the server if there is no other client accessing the requested database.

Solutions:

    g++ cv-server-client-database.cpp -o cv-server-client-database.out -lpthread
    ./cv-server-client-database.out
    g++ zemaphore.c zema-server-client-database.cpp -o zema-server-client-database.out -lpthread
    ./zema-server-client-database.out

cse314-pthread-synchronization-offline's People

Contributors

ezmata-101 avatar fardinanam avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.