Write a program to report behaviour of Linux kernel including kernel version, CPU type and model. (CPU information)

by

Last updated on Nov 4, 2022
Operating System Practicals (Question 2)

Input

#include<stdio.h>
#include<stdlib.h>
#include<sys/utsname.h>
using namespace std;
int main()
{
    int m=0;
    struct utsname s1;
    m=uname(&s1);
    
    if(m==0)
    {
        printf("\n The name of System:%s , system" , s1.sysname);
        printf("\n The version:%s" , s1.version);
        printf("\n The Machine:%s" , s1.machine);
        printf("\n");
        system("cat /proc/cpuinfo | awk 'NR==3, NR==4{print}' \n");
    }
    
    else
    {
        printf("Error");
    }
    return 0;
}

How useful was this post?

5 star mean very useful & 1 star means not useful at all.

Average rating 3.6 / 5. Vote count: 5

No votes so far! Be the first to rate this post.