Find Jobs
Hire Freelancers

C Programming, System programming, Process creation

$10-30 USD

In Progress
Posted about 8 years ago

$10-30 USD

Paid on delivery
Problem 1. Develop a program named ProcessTree.c. When the program is run, it accepts four command line arguments, denoted as h, m, s and d respectively. The program should create mulitple processes form a binary tree of height h. Let us identify these processes using integers 0, 1, · · · , 2h+1 −2 such that: (i) the process on the root is identified as 0; (ii) if the process identified as y is a child of the process identified as x, then y = 2x + 1 (left child) or y = 2x + 2 (right child). Among these processes, two can communicate with each other iff they are parent and child. You are required to use system calls fork and pipe for process creation and inter-process communication. Then, given that arguments m is a string while s and d are integers from {0, · · ·, 2h+1 − 2}, the process identified by s should send string m to the process identified by d via one or multiple pipes connecting the processes. During the course that string m is being sent, forwarded and received, every involved process should output its identify. Problem 2. Develop a program named ProcessForest.c. As in Problem 1, when the program is run, it accepts four command line arguments, denoted as h, m, s and d. The program should create two binary trees of processes where each process is identified by a pair (treeID, processID), where treeID is either 0 or 1, and within each tree, the processID of each process is determined in the same way as in Problem 1. Among these processes, each pair of processes that are parent and child on a tree can communicate with each other via pipe, and the two root nodes can communicate with each other through a shared memory block (Note: 1 you should use the POSIX shared memory library to create and manage the block). The argument m is a string, s and d are two pairs s = (s0, s1) and d = (d0, d1) where s0 and d0 are selected from {0, 1} while s1 and d1 are selected from {0, · · ·, 2h+1 − 2}. The process identified by s should send string m to the process identified by d hop by hop. During the course that the string m is being sent, forwarded and received, every involved process should output its identity. Problem 3. Develop a program name T hreadMapper.c. The program will be compiled together with (user-providing) functions named func1, func2 and func3, each of which has the signature of int func() and may call a function named void yield() whose functionality is to be explained later. The functionality of ThreadMapper is as follows: • First, for each of the functions func1, func2 and func3, a user thread that can run the function is created by initializing a context for the user thread. • Second, store these contexts into a queue. • Third, adopt the many-to-one mode to execute the user threads according to their orders in the queue. When a running user thread calls yield(), it should be unmapped from the kernel thread; its context should be saved and appended to the tail of queue, waiting for the next turn that it will be executed again.
Project ID: 9647641

About the project

3 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
3 freelancers are bidding on average $41 USD for this job
User Avatar
Hi, I am quite familiar and experienced in unix process programming using POSIC threads and can complete the assignment in 12 hours time. Please contact me as soon as possible if you need my help. With Regards, Koustav
$55 USD in 1 day
4.9 (135 reviews)
6.1
6.1

About the client

Flag of UNITED STATES
United States
0.0
0
Payment method verified
Member since Feb 14, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.