Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CPSC340- Operating System Spring 2019 Assignment 3 (25) Title: Semaphore programming Due Date: Thursday, 03/07/2019 This time you need to rewrite a multithreaded Pthread program

image text in transcribed
CPSC340- Operating System Spring 2019 Assignment 3 (25) Title: Semaphore programming Due Date: Thursday, 03/07/2019 This 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. gce assignment 3.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 Fibonacei number and prints Fibonacci sequence upon each Fibonacci number; . o Fibonacci count numbers with corresponding thread-name would be read using shiuMc main ( int arge, char argv 1) function. 4 Fibonacci numbers are entered on the command line such as: John 9 Doe 13 ESU 7 CPSC 9; Each Fibonacci number is executed by each thread shown below; o The program needs to create separate threads such that: . o Thread 1 with your first name, followed by the Fib sequence data; o Thread 2 with your last name, followed by the Fib sequence data; o Thread 3 with "ESU" followed by the Fib sequence data; o Thread 4 with "CPSC" followed by the Fib sequence data; The parent thread will print the sequence with the thread name printShare); o void printShare 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: . Implement as is without using sleep(), pthread_join(), or other functions on pp.136-137 of the OS textbook. Implement it after adding those statements

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions