Initial commit.
This commit is contained in:
commit
de812fb805
|
@ -0,0 +1,13 @@
|
|||
| System Object | Method | Value | Details |
|
||||
|-|-|-|-|
|
||||
| Maximum # of semaphores per process | static | 256 | Using POSIX values. Values specified in bits/posix1_lim.h. _POSIX_SEM_NSEMS_MAX |
|
||||
| Maximum value of a (counting) semaphore | static | 32767 | Using POSIX values. Values specified in bits/posix1_lim.h. _POSIX_SEM_VALUE_MAX |
|
||||
| Maximum value of a (counting) semaphore | empirical | 32767 | Tested in Arch. Did a for loop after getting a semaphore with semget. Used sem init to start at 1, and then added 1 to the semval using semop repeatedly in the for loop. semop failed once it hit 32767, saying “Numerical result out of range”. |
|
||||
| Maximum size of a shared memory segment (bytes) | empirical | 22879482108 | Tested in Arch from a PUTTY terminal. Did a for loop with shmget and shmctl in it. Started at 1 and multiplied by 2 each time, passing the value for the iteration into the size parameter of shmget(). Once it failed on that, I looped from the result / 2 to the result, adding 64 mb each time. Once I got a result from that, I looped from 64mb minus the result to the result of the first algorithm. Got values close to the one provided, but within some range. |
|
||||
| Page size (bytes) | dynamic | 4096 | Tested in Arch. sysconf(_SC_PAGESIZE) |
|
||||
| Physical pages in system | dynamic | 4109556 | Tested in Arch. sysconf(_SC_PHYS_PAGES) |
|
||||
| Maximum # of processes per user | dynamic | 63876 | Tested in Arch. sysconf(_SC_CHILD_MAX) |
|
||||
| Maximum file size (bytes) | dynamic | -1 (Unlimited) | Tested in Arch. getrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_max; |
|
||||
| Maximum # of open files: hard limit | dynamic | 4096 | Tested in Arch. getrlimit(RLIMIT_NOFILE, &rlim); rlim.rlim_max; |
|
||||
| Maximum # of open files: soft limit | dynamic | 1024 | Tested in Arch. getrlimit(RLIMIT_NOFILE, &rlim); rlim.rlim_cur; |
|
||||
| Clock resolution (msec) | dynamic | 10 | Tested in EOS. sysconf(_SC_CLK_TCK), converted from 100hz to 10ms (1000ms in a second / 100 ticks in a second) |
|
|
@ -0,0 +1,42 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long max = 1UL;
|
||||
|
||||
int semId;
|
||||
|
||||
semId = semget(IPC_PRIVATE, 1, 00600);
|
||||
semctl(semId, 0, SETVAL, 1);
|
||||
struct sembuf unlock = {0, 1, SEM_UNDO};
|
||||
|
||||
for (max = 1UL; max < 33366475776UL; max++)
|
||||
{
|
||||
// Incrementing semaphore.
|
||||
if (semop(semId, &unlock, 1) < 0)
|
||||
{
|
||||
printf("Max semaphore value: %lu\n", max);
|
||||
|
||||
// Flagging semaphore for deletion.
|
||||
if (semctl(semId, 0, IPC_RMID) < 0)
|
||||
{
|
||||
perror("can't deallocate\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
semctl(semId, 0, IPC_RMID);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Struct for getrlimit()
|
||||
struct rlimit rlim;
|
||||
|
||||
// For calculating clock resolution
|
||||
long ticks = 0L;
|
||||
|
||||
// Page size
|
||||
printf("Page size (bytes): %ld\n", sysconf(_SC_PAGESIZE));
|
||||
|
||||
// Physical pages
|
||||
printf("Number of physical pages: %ld\n", sysconf(_SC_PHYS_PAGES));
|
||||
|
||||
// # of processes per user
|
||||
printf("Max # of processes per user: %ld\n", sysconf(_SC_CHILD_MAX));
|
||||
|
||||
// File size
|
||||
getrlimit(RLIMIT_FSIZE, &rlim);
|
||||
printf("Max file size (bytes) | soft limit: %ld\n", rlim.rlim_cur);
|
||||
printf("Max file size (bytes) | hard limit: %ld\n", rlim.rlim_max);
|
||||
|
||||
// Number of open files
|
||||
getrlimit(RLIMIT_NOFILE, &rlim);
|
||||
printf("Number of open files | soft limit: %ld\n", rlim.rlim_cur);
|
||||
printf("Number of open files | hard limit: %ld\n", rlim.rlim_max);
|
||||
|
||||
// Getting ticks per second
|
||||
ticks = sysconf(_SC_CLK_TCK);
|
||||
|
||||
// Clock resolution
|
||||
printf("Clock resolution (ms): %ld\n", 1000 / ticks);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long max = 1UL;
|
||||
|
||||
unsigned long temp = 0UL;
|
||||
|
||||
int shmId;
|
||||
|
||||
for (max = 1; max < 10000000000000UL; max *= 2)
|
||||
{
|
||||
// Getting the shared memory segment.
|
||||
if ((shmId = shmget(IPC_PRIVATE, max, IPC_CREAT | S_IRUSR | S_IWUSR)) < 0)
|
||||
{
|
||||
temp = max;
|
||||
break;
|
||||
}
|
||||
|
||||
// Flagging shared memory for deletion.
|
||||
if (shmctl(shmId, IPC_RMID, 0) < 0)
|
||||
{
|
||||
perror("can't deallocate\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (max = temp / 2; max < temp; max += 67108864)
|
||||
{
|
||||
// Getting shared memory segment.
|
||||
if ((shmId = shmget(IPC_PRIVATE, max, IPC_CREAT | S_IRUSR | S_IWUSR)) < 0)
|
||||
{
|
||||
temp = max;
|
||||
break;
|
||||
}
|
||||
|
||||
// Flagging shared memory for deletion.
|
||||
if (shmctl(shmId, IPC_RMID, 0) < 0)
|
||||
{
|
||||
perror("can't deallocate\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (max = temp - 67108864; max < temp; max++)
|
||||
{
|
||||
// Getting the shared memory segment.
|
||||
if ((shmId = shmget(IPC_PRIVATE, max, IPC_CREAT | S_IRUSR | S_IWUSR)) < 0)
|
||||
{
|
||||
printf("Max value: %lu\n", max);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Flagging shared memory for deletion.
|
||||
if (shmctl(shmId, IPC_RMID, 0) < 0)
|
||||
{
|
||||
perror("can't deallocate\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue