Need detail comments:1) Your program will make use of the POSIX system I/O calls and pthreads library discussed in lectures. That is, you must only use open(), close(), pread(), pwrite() and the pthreads library function calls for multithreading. Your program will have the main thread and ten pthreads in a boss-worker thread pattern. 2) You are NOT permitted to use any C++ nor C standard I/O library functions nor cin nor cout. Furthermore, you cannot use any C++ nor C standard library functions for string operations. 4) Your program will do the following three actions after having opened the input text file. All thread output goes to the screen (standard out). a) Use the main thread to read the input file of 10,000 unsorted integers (1 line per integer in character format) from the beginning of the file to the end of file. While reading the input file you collect the start and end offsets of each of the 10 input file chunks of 1,000 lines each. Each file chunk obviously has 1,000 numbers. The main thread writes 10 lines of file chunk information in the following format for each line: Main Output: \t logical thread number \t start offset \t end offset \n b) The main thread creates 10 worker pthreads (one pthread per file chunk as in (a)). Each pthread runs a function called computeMin (which you will also write) to take the start and end offsets and a file chunk number (0,1,2,...,9), read the input file, and determine the minimum integer of the file chunk. Each worker pthread saves this minimum in the chunk to a global array of 10 integers at the element number given by the file chunk number. Each worker pthread itself writes one line of output in the following format for each line: Worker Output: \t logical thread number \t start offset \t end offset \t minimum integer \n c) The main thread will determine the global minimum (that is, the minimum of the global array of 10 integers). The main thread writes one line of final output in the following format: Main Output: The global minimum = \t PLACE THE ACTUAL GLOBAL MINIMUM HERE \n

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Need detail comments:1) Your program will make use of the POSIX system I/O calls and pthreads library discussed in lectures. That is, you must only use open(), close(), pread(), pwrite() and the pthreads library function calls for multithreading. Your program will have the main thread and ten pthreads in a boss-worker thread pattern. 2) You are NOT permitted to use any C++ nor C standard I/O library functions nor cin nor cout. Furthermore, you cannot use any C++ nor C standard library functions for string operations. 4) Your program will do the following three actions after having opened the input text file. All thread output goes to the screen (standard out). a) Use the main thread to read the input file of 10,000 unsorted integers (1 line per integer in character format) from the beginning of the file to the end of file. While reading the input file you collect the start and end offsets of each of the 10 input file chunks of 1,000 lines each. Each file chunk obviously has 1,000 numbers. The main thread writes 10 lines of file chunk information in the following format for each line: Main Output: \t logical thread number \t start offset \t end offset \n b) The main thread creates 10 worker pthreads (one pthread per file chunk as in (a)). Each pthread runs a function called computeMin (which you will also write) to take the start and end offsets and a file chunk number (0,1,2,...,9), read the input file, and determine the minimum integer of the file chunk. Each worker pthread saves this minimum in the chunk to a global array of 10 integers at the element number given by the file chunk number. Each worker pthread itself writes one line of output in the following format for each line: Worker Output: \t logical thread number \t start offset \t end offset \t minimum integer \n c) The main thread will determine the global minimum (that is, the minimum of the global array of 10 integers). The main thread writes one line of final output in the following format: Main Output: The global minimum = \t PLACE THE ACTUAL GLOBAL MINIMUM HERE \n
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Race Condition
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education