StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...

Handling Concurrent Access of Shared Resource - Assignment Example

Cite this document
Summary
The objective of this assignment is to resolve a programming problem where there is a need to handle concurrency of customer and server entities. The writer provides a use case, class and sequence diagrams as well as source code for the implementation of the described problem…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER98% of users find it useful
Handling Concurrent Access of Shared Resource
Read Text Preview

Extract of sample "Handling Concurrent Access of Shared Resource"

Download file to see previous pages

BurritoBrothers – Shop can be shared by multiple customers at a time, with a limit on a total number of customers. Counter Semaphore can be used to keep a check on a number of customers getting entry into Burrito Brothers shop. Per problem counter, semaphore should be initialized to '3'.Secondly, a binary semaphore to keep track of whether a customer is being served by a Server or not. This will avoid customer thread to gain access to multiple counters at a time.Cash Register - Like Counter location, the cash register is also shared by customers.

Since there exists a single cash register and only one customer can access it at a given moment. A binary semaphore can be used to control customers waiting to pay from paying together but would ensure they pay one by one.So, four different semaphores are needed to handle concurrency of Customer and Server as per the given problem. Both Customer and Server extend Thread class. However, both classes have different sets of responsibilities.Customer 1. Step into Burrito Brothers shop, if there is space available. 2. After stepping in, wait till the customer becomes a customer with the smallest order in waiting Area. 3. Once, a customer becomes the customer with the smallest order to acquire a free counter. 4. Leave counter and join waiting Area. 5. If more burritos are needed keep performing steps 3 & 4. 6. If an order is a complete wait for a cash register to get free. 7. Once the cash register is free to leave waiting Area and acquires cash register. 8. Pay. 9. Leave the cash register. 10. Leave Burrito Brothers. Server 1. Wait for the customer to serve. 2. Once the customer is at the counter, prepare three or fewer burritos. 3. Handover them and again go to step 1.

Additional, two classes are needed in the solution which is not mentioned in the class diagram. 1. CustomerGenerator - A class to generate new customers with random orders. 2. World - A class which creates. Since there exists a single cash register and only one customer can access it at a given moment. A binary semaphore can be used to control customers waiting to pay from paying together but would ensure they pay one by one. Since a customer with the smallest order needs to get a change to aquireCounter first Waiting Area is implemented as TreeSet which automatically sorts objects if the object implements Comparable interface.

Customers just need to check whether they are first in Tree Set to know whether they are eligible to acquire Counter Location, if available.

...Download file to see next pages Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(Handling Concurrent Access of Shared Resource Assignment, n.d.)
Handling Concurrent Access of Shared Resource Assignment. Retrieved from https://studentshare.org/logic-programming/1501036-programming-project-in-java
(Handling Concurrent Access of Shared Resource Assignment)
Handling Concurrent Access of Shared Resource Assignment. https://studentshare.org/logic-programming/1501036-programming-project-in-java.
“Handling Concurrent Access of Shared Resource Assignment”, n.d. https://studentshare.org/logic-programming/1501036-programming-project-in-java.
  • Cited: 0 times

CHECK THESE SAMPLES OF Handling Concurrent Access of Shared Resource

Database Architecture for GEMLCA Resource Availability

nbsp;A grid client deficient in some kind of resource can access the resources of other grid clients.... hellip; Computational resources as supercomputers, computer clusters, storage systems, data sources, instruments and people connected through a network are synched together and work as a single resource.... GEMLCA resource layer manages the interaction between Grid services and Grid Host Environment.... resource Layer is used for the following purposes:Deploying legacy applications as Grid servicesQuerying the GEMLCA resources and get the list of available legacy applicationsgetting the list of legacy parameters with default values and allow the user to modify thesesubmitting legacy jobs to a job managerquerying the status of previously submitted legacy jobsretrieving results from legacy applicationsGEMLCA resource layer has the following three services:GLCAdminIt deploys a legacy application as a Grid service....
9 Pages (2250 words) Research Paper

Windows XP Operating System

One advantage of the layered operating structure is that each layer of code is given access only to the layer below it (interfaces and data structures).... Software in the user mode cannot access hardware directly....  The kernel mode has unrestricted access to the system memory and external devices.... In this mode, software can access the hardware and system data as well as system resources directly....
8 Pages (2000 words) Essay

Further Computer Systems Architecture

Predication is an effective technique that allows the handling of complex activities when the computer pursues aggressive instruction-level parallelism (ILP).... The assignment "Further Computer Systems Architecture" states that Traditional architecture could no longer address the complex and growing need to process massive data at a given time....
9 Pages (2250 words) Assignment

Real Time Embedded Systems

They are more prevalent in 'concurrent programming'.... eadlock-free execution of concurrent programs is indeed difficult, but it is important as multi-core processors force software developers to do applications simultaneously.... To guarantee deadlock-free operation feedback controllers for concurrent programs are synthesized based on place variants....
10 Pages (2500 words) Assignment

Software Architecture

In a style or pattern, components could be computational, memory-related, managerial, or a controller while the connector depicting interaction mechanisms between components could be procedure call, data flow, implicit invocation, message passing, shared data, or instantiation.... The paper "Software Architecture" presents an overview of the most commonly used architecture styles and patterns....
6 Pages (1500 words) Term Paper

TinyOS and nesC Programming Approaches and Challenges for Networked Embedded Systems

Additionally, nesC openly addressed the issue of concurrent access to the collective data.... The problem that data is shared across components defends the false positives for buffer swapping.... In addition, the problems for data being shared between split-phase operations that should explain the event that can potentially fire if there is access to other components HW.... This shows that the second event arrival and data processing are concurrent and all the activities demand the main approach to the concurrency management that tend to address the potential bugs such as race conditions....
2 Pages (500 words) Research Paper

The Inner and Out Key Issues Related to Design Data Management

resource data, which describe the appropriate resources used for production, some of these may be materials, machines, and tools.... Any database is a bunch of non – redundant information that has to be shared.... These problems are analyzed in the light of concepts like data exchange protocols, Product Data Management Systems (PDMS), Product Lifecycle Management (PLM) and concurrent Engineering (CE) practices.... Also, the problems related to design team management is considered with respect to concepts related to cross-functional teams that enable concurrent Engineering practices....
13 Pages (3250 words) Case Study

Distributed Systems Programming

Distributed systems sometimes share a common goal, such as solving large computational problems, alternatively, with each computer having its own user with different individual needs, and the purpose of each distributed system is to coordinate the use of shared resources or providing communication services to the users.... nbsp;The main two classes of servers are iterative and concurrent....
5 Pages (1250 words) Essay
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us