[SOLVED] 代写 C game ENGG1340COMP2123 Programming technologies and tools

30 $

File Name: 代写_C_game_ENGG1340COMP2123_Programming_technologies_and_tools.zip
File Size: 612.3 KB

SKU: 4867928495 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


ENGG1340COMP2123 Programming technologies and tools
Mini ProjectC threads and race conditions
In this mini project, you will be guided to selflearn some new concepts and write a small program in C that uses these concepts threads. Besides our primary instructions, you are encouraged to do selflearning on these new concepts and seek for further tutorials on how to use them. Note that contents in this selflearning mini project will not show in the final exam.
Problem Description
You are required to implement a Game of CellCulture program that operates in the following way: the game takes a list of gene seeds Integer N as input, and a bunch of genesis cell threads are produced according to the input. The genesis cell will live a certain life time0.1N8 secondsandduringitslifetimeanditwillbringacertainnumberNN 88 ofchild cells in the middle 12 of its life time. Each child cell should live the same life time as its parent cell, but no child is brought. After life time expires, a cell will be dead.
A cellculture monitor is started just before the first genesis cell is created. The monitor will print out the number of existing live cells every second, so you can continuously monitors how many cells are live.
Program Instructions
1. A main function waits input from user. When the first inputs are given, it will start the monitor thread and then start the genesis cells threads.
2. The number of live cells is counted by a global counter which is shared by all the threads. Note that the counter should be accessed with mutex see later sections, which means at any time, only one thread can modify this counter.
3. The monitor thread will read the counter every second, and print the number of current live cells.
4. You can use C std::thisthread::sleepfor to simulate a cells life time.

Inputs and Outputs Format
.cellculture
Main Please input a list of gene seeds: 1234
Monitor Started0 s
Monitor Total cells: 41 s

C Threads
Here are some online resources that tells you how to use C threads. You would like to read Part 1and Part 2 to learn about how to use threads. Part 3 is related to how to pass initialization values to a thread. Part 4 and Part 5 tells you how to use a global counter while avoiding race conditions. You will learn what is race condition, an important concept in modern computer systems. Moreover, there are consequent tutorials that teach you how to use event handling. You can learn subsequent tutorials by yourself Part 69.
C11 Multithreading Part 1: Three Ways to Create Threads C11 Multithreading Part 2: Joining and Detaching Threads C11 Multithreading Part 3: Passing Arguments to Threads C11 Multithreading Part 4: Sharing DataRace Conditions C11 Multithreading Part 5: Fixing Race Conditions using mutex

Submission and sample test cases
The sample program and test cases will be released after Nov 10, 2019, via moodle. Your submission should be in the form of UID.zip e.g., 30312342222.zip. Note that it should exactly be a ZIP file. The ZIP file directly no sublevel directory contains your source codes and a Makefile, which makes your program to an executable. The filename of the final executable should be cellculture. Incorrect submission formats might result in a zero mark.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 C game ENGG1340COMP2123 Programming technologies and tools
30 $