Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help is greatly appreciated! (IN C LANGUAGE) REQUIREMENTS: - MUST USE DUP, FILENO, POPEN, GREP & WC DETAILS: Question #2: Implementing print-num-cores() [20 pts] We

Help is greatly appreciated! (IN C LANGUAGE)

REQUIREMENTS:

- MUST USE DUP, FILENO, POPEN, GREP & WC

DETAILS:

image text in transcribed

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 fileno

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

Nested Relations And Complex Objects In Databases Lncs 361

Authors: Serge Abiteboul ,Patrick C. Fischer ,Hans-Jorg Schek

1st Edition

3540511717, 978-3540511717

Students also viewed these Databases questions

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

Identify conflict triggers in yourself and others

Answered: 1 week ago