Suoritettu

Write a C program that creates two threads and runs them simultaneously

Write a C program that creates two threads and runs them simultaneously. Yarns will run on a global array and perform a cumulative addition. The total will be kept on a global value. One of the threads must run in the sequence from beginning to end, and the other from end to beginning. Each thread will read a single value and add to the global sum. Since threads operate on a common variable, you need to edit the access rights to this value using a semaphore. Also, you should not forget to check if there are any elements to be read in the array. The size of the directory will be taken from the user. A random array of numbers (0-9) will be created according to the entered dimension value. The created sequence will be printed on the screen. You can examine the pthread_create and pthread_join commands in the pthread library for thread formation and usage. Sample input and program output should be as follows.

Example Input:

10

Sample Output (Running sequence of threads can be different at each run):

Random Sequence => 4 2 8 1 5 3 7 9 6 9

Thread1 read the value of 4 total = 4

Thread1 read the value of 2 total = 6

Thread2 read the value 9 total = 15

Thread1 read the value of 8 total = 23

Thread2 read the value of 6 total = 29

Thread2 read the value 9 total = 38

Thread2 read the value 7 total = 45

Thread1 read the value of 1 total = 46

Thread2 read the value of 3 total = 49

Thread2 read the value of 5 total = 54

Thread2 could not find the value to be read.

Note: Write a C / C ++ program that does all these operations. To run your program (for C code):

gcc StudentNumber.c --lpthread

./[login to view URL]

Taidot: C++ -ohjelmointi, C-ohjelmointi

Näytä lisää: mypoint class write test program creates points, implement class write test program creates points, write c program online, write c program, write c++ program online, write c# program, how to write c++ program, how to write c program in linux terminal, c program to create a file and perform read and write operations, how to write c program in ubuntu, how to write c program in cygwin, how to write c++ program in linux terminal, how to write c program in matlab, how to write c++ program in qt creator, write c++ program to convert the change given in quarters dimes nickels and pennies into pennies, how to write c++ program in linux, where to write c program, how to write c program, how to write c program in unix, write c++ program to convert the change given in quarters, dimes, nickels and pennies into pennies

Tietoa työnantajasta:
( 0 arvostelua ) Ankara, Turkey

Projektin tunnus: #30226136

Myönnetty käyttäjälle:

MBF0339

I'm in last year of BSCS. And i have best command in these languages plus. Plus your query is so well explained and understandable.

$15 USD 6 päivässä
(0 Arvostelua)
0.0

6 freelanceria on tarjonnut keskimäärin $28 tähän työhön

SPARKtechBD

Since 2015 I am working in C/C++ programming. So more than 5(five) years of experience in C/C++ programming. I can build any function or method for you. If you want a good delivery of the project, then send me a messag Lisää

$50 USD 2 päivässä
(18 arvostelua)
5.6
viktorbelman01

Dear Sir. As an experienced algorithm expert, it is very interesting to me. I have been working on several data structure & algorithm projects such yours for over 7+ years. Since having programming contestant experienc Lisää

$40 USD 1 päivässä
(17 arvostelua)
4.6
Paulzwork

Hello, Hi.. I can help you writing the code with two threads. I'm good at programming and coding in C, Python, C++ and bash.... Let me know, if you need my help. I'd like to help you. :) _______________________ Lisää

$25 USD 1 päivässä
(7 arvostelua)
2.9
faisalnaseer795

My motto is to provide high quality work and client satisfaction delivered before your deadline. | jquery, JavaScript, Mysql, PSD to HTML , Graphic Design & Website [login to view URL] | iPhone | Laraval I Hybrid app I E-Co Lisää

$20 USD 1 päivässä
(0 arvostelua)
0.0
egaracia

Dear! I have read your project description and I'm very interested in your project. I have enough experience in C/C++ and thread. I can do this well as you want. Please send me a message so that we can discuss more d Lisää

$15 USD 1 päivässä
(0 arvostelua)
0.0