Answered step by step
Verified Expert Solution
Question
1 Approved Answer
IN C PLEASE Question #2: Implementing print-num-cores() [20 pts] We now implement the print_num cores () function, which is called to print the number of
IN C PLEASE
Question #2: Implementing print-num-cores() [20 pts] We now implement the print_num cores () function, which is called to print the number of cores available on the machine. Here is an example interaction: 1. See the kernel release 2. See the number of cores 3. See the RAM capacity 4. Exit user types '2" 4 The above means that there are 4 cores on the machine. This number is obtained by counting the number of lines in file /proc/cpuinfo that contain the string "processor". Hints: The main idea is to call grep and pass its output to we (with the command-line argument that only prints lin count; read the man page) This is a typical example for which using popen is key As seen in the lecture note examples, you'll also need to use dup and filenoStep 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