Giter VIP home page Giter VIP logo

ice-cream-factory-in-linix-c-using-multi-threading's Introduction

Ice Cream Factory using Multi Thread Programming

A thread is a single sequence stream within in a process. Because threads have some of the properties of processes, they are sometimes called lightweight processes. In a process, threads allow multiple executions of streams. In many respect, threads are popular way to improve application through parallelism. The CPU switches rapidly back and forth among the threads giving illusion that the threads are running in parallel. Like a traditional process i.e., process with one thread, a thread can be in any of several states (Running, Blocked, Ready or terminated). Each thread has its own stack. Since thread will generally call different procedures and thus a different execution history. This is why thread needs its own stack. An operating system that has thread facility, the basic unit of CPU utilization is a thread. A thread has or consists of a program counter (PC), a register set, and a stack space. Threads are not independent of one other like processes as a result threads shares with other threads their code section, data section, OS resources also known as task, such as open files and signals.

In this project we have implemented Ice cream factory using Multi-Threading, in which component of ice creams are a made by Thread at each counter. These Threads will be executing concurrently with other Threads It consist of two components Client and Server implemented on Inter process communication with shared memory. Firstly Server will allocate the shared memory with address to which our Ice cream (Thread) will do function. Then it will write data on thread by allocating flavors to our ice cream and then it will call other processor. After all it will detach and DE-allocate the shared memory segments of our Ice-cream or Thread of client and server. While in the Client shared memory segments will be allocated and attached to our ice cream components or Threads. Local semaphore will be used there .It will also show as Ice cream or thread has been successfully created.

Order of ice cream will arrived at first counters then sequence of counter will accomplish the order by providing different flavors for their ice-creams. They will be served by multiple flavors including in critical section and after that it will wait for 5 sec so that ice cream flavors will be assign to ice cream without any hurdle. After completely filling, Ice cream orders will be ready to distribute.

#Instruction:

1.first open terminal to run the server 2.compile server using gcc -o ser ser.c 3.now run the server ./ser

4.Now open another terminal in same folder to run client 5.Compile the client using gcc -o cli -pthread cli.c 6.Now run the client ./cli

7.It will ask you the numbers of counter you want from (1-10)

ice-cream-factory-in-linix-c-using-multi-threading's People

Stargazers

 avatar

Watchers

 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.