-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path005.c
More file actions
57 lines (46 loc) · 2.27 KB
/
Copy path005.c
File metadata and controls
57 lines (46 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
..........................................................................................................................................
Name : 005.c
Author : SHRUTI VERMA
Description : Write a program to print the system limitation of
a. maximum length of the arguments to the exec family of functions.
b. maximum number of simultaneous process per user id.
c. number of clock ticks (jiffy) per second.
d. maximum number of open files
e. size of a page
f. total number of pages in the physical memory
g. number of currently available pages in the physical memory.
Date : 29 Sep 2025
..........................................................................................................................................
*/
#include<unistd.h>
#include<stdlib.h>
#include<stdio.h>
#include<sys/sysinfo.h>
int main() {
long arg_max = sysconf(_SC_ARG_MAX);
printf("maximum length of the arguments to the exec family of functions : %ld\n", arg_max);
long max_process = sysconf(_SC_CHILD_MAX);
printf("maximum number of simultaneous process per user id : %ld\n", max_process);
long jiffy = sysconf(_SC_CLK_TCK);
printf("number of clock ticks (jiffy) per second : %ld\n", jiffy);
long openFiles = sysconf(_SC_OPEN_MAX);
printf("maximum number of open files : %ld\n", openFiles);
long pageSize= sysconf(_SC_PAGE_SIZE);
printf("size of a page : %ld\n", pageSize);
struct sysinfo info;
sysinfo(&info);
unsigned long memSize = info.totalram;
printf("total number of pages in the physical memory : %ld\n", memSize/pageSize);
unsigned long memFree = info.freeram;
printf("number of currently available pages in the physical memory : %ld\n", (memSize - memFree)/pageSize);
}
/*--------------------------------------OUTPUT--------------------------------------
maximum length of the arguments to the exec family of functions : 2097152
maximum number of simultaneous process per user id : 30107
number of clock ticks (jiffy) per second : 100
maximum number of open files : 1048576
size of a page : 4096
total number of pages in the physical memory : 2002505
number of currently available pages in the physical memory : 1919644
*/