Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Multi-threaded programming help!!! Can anyone solve this problem? It has to be written in C, runs on Linux. his time you need to rewrite a
Multi-threaded programming help!!! Can anyone solve this problem? It has to be written in C, runs on Linux.
his time you need to rewrite a multithreaded Pthread program that works with sleep() or pthread_join() in order to print out Fibonacci sequences properly. Create a folder name, WK6 on your class Linux machine when you work. gcc assignment3.c-Wall -Werror -pthread You are required to develop your own program using C with the following information Need to declare a function that receives Fibonacci number and prints Fibonacci sequence upon each Fibonacci number; o Fibonacci count numbers with corresponding thread-name would be read using main nt argc, char * argv I) function 4 Fibonacci numbers are entered on the command line such as: John 9 Doe 13 ESU 7 CPSC 9; a o Each Fibonacci number is executed by each thread shown below; The program needs to create separate threads such that: Thread 1 with your first name, followed by the Fib sequence data; Thread 2 with your last name, followed by the Fib sequence data; Thread 3 with "ESU" followed by the Fib sequence data; Thread 4 with "CPSC" followed by the Fib sequence data; o The parent thread will print the sequence with the thread name printShare); void *printShare () o o pthread mutex lock(&lock); o write or printf (Each Fib sequence that begins with name); o pthread mutex_ unlock(&lock); You may implement your program such as: o Implement as is without using sleep(), pthread join( ) Implement it after adding those statementsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started