Question: The following program must be written in java and use a system call. Will promptly rate, if program compiles and executes. Exercise : Write a

The following program must be written in java and use a system call. Will promptly rate, if program compiles and executes.

Exercise : Write a program in Java to display the following information in Linux.

1. General information. In this section you will assemble some basic facts about the system

Machine name (hostname) # get this information from /proc/sys/kernel/hostname

System date and time # get this information from /proc/driver/rtc

Kernel version # get this information from /proc/version

Memory usage (used and free memory) # get this information from /proc/meminfo

2. Time information. In this section you will print out how long the system has been up and how busy it has been.

a. Duration of uptime # get these information from /proc/uptime

b. Duration of idletime

The skeleton of the program

(1) read file /proc/uptime to obtain Totaltime and Idletime

(2) read file /proc/sys/kernel/hostname to obtain the hostname

(3) read file /proc/version to obtain the kernel version

(4) read file /proc/meminfo to obtain the amount of used memory and free memory

(5) read file /proc/driver/rtc to obtain time and date

Items to turn in to Week 6 dropbox:

Source code with filename (linuxsys.c or linuxsys.cpp or linuxsys.java)

Sample output from your program

NOTE: (IMPORTANT !!!)

All the source file should be with enough documentation either embedded in the code or in a separate file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!