Find Jobs
Hire Freelancers

bankers algorithm,passing a virtual address on the command line

$10 USD

Cerrado
Publicado hace más de 8 años

$10 USD

Pagado a la entrega
2) Assume that a system has a 32-bit virtual address with a 4-KB page size. Write a C program that is passed a virtual address (in decimal) on the command line and have it output the page number and offset for the given address. As an example, your program would run as follows: ./[login to view URL] 19986 Your program would output: The address 19986 contains: page number = 4 offset = 3602 Writing this program will require using the appropriate data type to store 32 bits. We encourage you to use unsigned data types as well. 1)bankers algorithm For this project, you will write a multi threaded program that implements the banker’s algorithm discussed in Section 7.5.3. Several customers request and [login to view URL] the system in a safe state. A request that leaves the system in an unsafe state will be [login to view URL] programming assignment combines three separate topics: (1)multi threading,(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. The use of Pthreads mutex locks is covered in Section 5.9.4;mutex locks for Windows systems are described in the project entitled“Producer–Consumer Problem” at the end of Chapter5. Implementation 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.
ID del proyecto: 9000262

Información sobre el proyecto

5 propuestas
Proyecto remoto
Activo hace 8 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
5 freelancers están ofertando un promedio de $61 USD por este trabajo
Avatar del usuario
I am very proficient in c, c++. I have 16 years c++ developing experience now, and I have worked for 6 years. My work is online game developing, and mainly focus on server side, the language is c++ under linux. I used c++ to make many great projects, for example, I made the tools which can convert java files to c++ scripts which has the same effect, of course garbage collection included. I also made our own mobile game using c++, I even can show you the demo of client. Trust me, please let expert help you.
$150 USD en 1 día
4,9 (55 comentarios)
6,2
6,2
Avatar del usuario
Hi there! I'm a Professional Software developer and Data Analyst for a well known Software House in Islamabad named PacSquare Pvt Ltd. If I get this job, I assure you that you'll get my best services in return. Please consider my proposal, and discuss additional Info for this specific Project. Thanks for Reading! Best, Maher p.s. I read the details but they are in a little confusing format. But i got the requirements clear somehow. Please discuss over chat
$40 USD en 1 día
5,0 (35 comentarios)
4,9
4,9
Avatar del usuario
A proposal has not yet been provided
$50 USD en 1 día
4,9 (13 comentarios)
3,6
3,6
Avatar del usuario
hi , i am a c programmer and linux/unix system admin and worked with multithreading and IPC and i know python and shell script
$55 USD en 3 días
4,8 (1 comentario)
0,5
0,5
Avatar del usuario
Hi. I already have the implementation of the second problem. I can send it just right now. I claim only $5 for it, another $5 is minimum fee of the website so don't think that I'm too greedy :)
$10 USD en 0 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
United States
0,0
0
Miembro desde nov 29, 2015

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.