Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 Threads You'll write a multithreaded program to look for the longest sequence of digits in the first 10000 digits of pi such that the
1 Threads You'll write a multithreaded program to look for the longest sequence of digits in the first 10000 digits of pi such that the last digit in the sequence is the sum of the previous digits in the sequence. You may work alone or with a partner. You'll do this in by writing two functions: int readFile(char *filemame, int *numChars, char *buffer); void *findMaxSumSeq (void *param); These functions are described below. 1.1 Example program First, get pthreads-example-simpler.c from the class gitlab repo. Compile this and run it. This program shows an example of how to create pthreads and pass data to them. On silk, you will need to compile this in the following way: $ gcc pthreads-example-simpler.c -lpthread You can also run this on macOS (and possibly on Windows?). To compile it at the command line on macOS: $ gcc pthreads-example-simpler.c 2 Reading a File Create your own file threads.netid.c Then, write the function int readFile(char f ileName, int *numChars). This file will read lines from the specified file and will put each of these lines into a large character buffer. On success, it will return zero; otherwise, it will return a nonzero value. Here's how you'll call your function: \#define BUFLEN 10100 int main(int argc, char *argv[]) \{ int rc, numChars; char buffer [BUFLEN] ; if (argc
Step 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