Find Jobs
Hire Freelancers

Write some Software

$10-30 USD

Fermé
Publié il y a plus de 8 ans

$10-30 USD

Payé lors de la livraison
Banker’s Algorithm For this project, you will write a multithreaded program that implements the banker’s algorithm. Several customers request and release resources from the bank. The banker will grant a request only if it leaves the system in a safe state. A request that leaves the system in an unsafe state will be denied. This programming assignment combines three separate topics: (1) multithreading, (2) preventing race conditions, and (3) deadlock avoidance. The Banker The banker will consider requests from n customers for m resources types. as outlined in Section 7.5.3. The banker will keep track of the resources using the following data structures: /* these may be any values >= 0 */ #define NUMBER OF CUSTOMERS 5 #define NUMBER OF RESOURCES 3 /* the available amount of each resource */ int available[NUMBER OF RESOURCES]; /*the maximum demand of each customer */ int maximum[NUMBER OF CUSTOMERS][NUMBER OF RESOURCES]; /* the amount currently allocated to each customer */ int allocation[NUMBER OF CUSTOMERS][NUMBER OF RESOURCES]; /* the remaining need of each customer */ int need[NUMBER OF CUSTOMERS][NUMBER OF RESOURCES]; The Customers Create n customer threads that request and release resources from the bank. The customers will continually loop, requesting and then releasing random numbers of resources. The customers’ requests for resources will be bounded by their respective values in the need array. The banker will grant a request if it satisfies the safety algorithm outlined in Section 7.5.3.1. If a request does not leave the system in a safe state, the banker will deny it. Function prototypes for requesting and releasing resources are as follows: int request resources(int customer num, int request[]); int release resources(int customer num, int release[]); These two functions should return 0 if successful (the request has been granted) and –1 if unsuccessful. Multiple threads (customers) will concurrently access shared data through these two functions. Therefore, access must be controlled through mutex locks to prevent race conditions. Both the Pthreads and Windows APIs provide mutex locks. You should invoke your program by passing the number of resources of each type on the command line. For example, if there were three resource types, with ten instances of the first type, five of the second type, and seven of the third type, you would invoke your program follows: ./[login to view URL] 10 5 7 The available array would be initialized to these values. You may initialize the maximum array (which holds the maximum demand of each customer) using any method you find convenient.
N° de projet : 9109315

Concernant le projet

8 propositions
Projet à distance
Actif à il y a 8 ans

Cherchez-vous à gagner de l'argent ?

Avantages de faire une offre sur Freelancer

Fixez votre budget et vos délais
Soyez payé pour votre travail
Surlignez votre proposition
Il est gratuit de s'inscrire et de faire des offres sur des travaux
8 freelances proposent en moyenne $108 USD pour ce travail
Avatar de l'utilisateur
A proposal has not yet been provided
$26 USD en 1 jour
4,9 (890 commentaires)
7,3
7,3
Avatar de l'utilisateur
Hi. i have a lot of experience in OS. I think i can help you with this project at low cost.. we can have a chat about it. thanks
$70 USD en 1 jour
4,9 (350 commentaires)
7,2
7,2
Avatar de l'utilisateur
A proposal has not yet been provided
$111 USD en 1 jour
5,0 (32 commentaires)
5,2
5,2
Avatar de l'utilisateur
Hi, I can do this. I am an expert c programmer. I have developed applications using multi threading, semaphores, process/fork, shared memory etc. -Rajesh
$30 USD en 1 jour
5,0 (22 commentaires)
5,0
5,0
Avatar de l'utilisateur
A proposal has not yet been provided
$250 USD en 7 jours
5,0 (5 commentaires)
2,4
2,4
Avatar de l'utilisateur
A proposal has not yet been provided
$277 USD en 3 jours
0,0 (0 commentaires)
0,0
0,0
Avatar de l'utilisateur
I KNOW THE BANKERS ALGORITHM.I AM DEFINITE I CAN DO YOUR PROJECT. PLEASE CONTACT ME SO I CAN PRESENT YOU THE PROJECT
$10 USD en 1 jour
0,0 (0 commentaires)
0,0
0,0
Avatar de l'utilisateur
I have scored A's in C programming and system programming. I have recently been working with multithreaded server. i can provede you samples of my work if required. i am sure that i can meet your requirements.
$88 USD en 2 jours
0,0 (0 commentaires)
0,0
0,0

À propos du client

Drapeau de SAUDI ARABIA
Saudi Arabia
0,0
0
Membre depuis déc. 12, 2015

Vérification du client

Merci ! Nous vous avons envoyé un lien par e-mail afin de réclamer votre crédit gratuit.
Une erreur a eu lieu lors de l'envoi de votre e-mail. Veuillez réessayer.
Utilisateurs enregistrés Total des travaux publiés
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Chargement de l'aperçu
Permission donnée pour la géolocalisation.
Votre session de connexion a expiré et vous avez été déconnecté. Veuillez vous connecter à nouveau.