Write a C Program that writes all the numbers from 1 to 100,000 that are both prime and the sum of the digits > 9. For example 47, 911 are 2 such numbers, since the sum of the digits is > 9. After finding a number, you must immediately write it to the output file. Open the file, write the number you just found, and close the file. Measure how much elapsed time it takes to do this processing. Yes, it is inefficient, but we are trying to force some I/O usage, which will cause interrupts. When this process is completed, next have the program fork and create 10 separate processes. Each process would find search a range of 1 to 100,000 for these prime and sum 11 numbers. One process searches 1 to 10000, another 10001 to 20000 etc. Each process performs the exact same tasks , in the same way, as the first part of the problem, but write the output to 10 separate files, one for each process. When all 10 processes are done, read the ten files to make one file with all the numbers. Measure the elapsed time it takes for all 10 processes to complete, and to create the output file. Make sure you research the difference between capturing CPU time and elapsed time. The CPU time will be the same, but the elapsed time is different between the two approaches

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

Program in C only - thanks

Write a C Program that writes all the numbers from 1 to 100,000 that are both prime and the sum of the digits > 9. For example 47, 911 are 2 such numbers, since the sum of the digits is > 9. After finding a number, you must immediately write it to the output file. Open the file, write the number you just found, and close the file. Measure how much elapsed time it takes to do this processing. Yes, it is inefficient, but we are trying to force some I/O usage, which will cause interrupts.

When this process is completed, next have the program fork and create 10 separate processes. Each process would find search a range of 1 to 100,000 for these prime and sum 11 numbers. One process searches 1 to 10000, another 10001 to 20000 etc. Each process performs the exact same tasks , in the same way, as the first part of the problem, but write the output to 10 separate files, one for each process. When all 10 processes are done, read the ten files to make one file with all the numbers. Measure the elapsed time it takes for all 10 processes to complete, and to create the output file.

Make sure you research the difference between capturing CPU time and elapsed time. The CPU time will be the same, but the elapsed time is different between the two approaches.

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
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
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