Memory resident programs


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Memory resident programs
# 1  
Old 10-10-2005
PHP Memory resident programs

How can you make a program as Memory resident in AIX.
If I make a program as a memory resident program whether all the parts of the program like code and data (stack) segements of the program will be loaded in to the Memory.

For Ex:
I have a C code which is creating array of 10000 long ints and will be initialized with some data. Whether this array will be there in the memory along with the code or not.

Thanks a lot for your time and information.

Thanks and Regads,
Pola Balaji

Last edited by Pola Balaji; 10-11-2005 at 02:26 AM..
# 2  
Old 10-10-2005
Short answer: yes the data will be there in memory. The entire array.

By memory-resident do you mean a daemon?
# 3  
Old 10-10-2005
In this context, I think memory-resident might mean a process which cannot be swapped out to disk.

I checked with Mr. Google, and found this link which seems to confirm my thoughts.
# 4  
Old 10-10-2005
Yeah, I think he is talking about memory locking. If physical memory is in short supply, some of that array may get paged out...but not if it is locked. I don't use AIX, but I can make some comments about unix in general. Processes can be locked into physical memory, programs cannot. If the process exits or execs most locks are released. The system calls are:

plock()
This was the original system call. It is not in the Posix Standard and it is showing its age. It knows about two memory segments: text and data. In the old days, the stack was in the data segment. The docs tiptoe around what DATLOCK really means today. PROCLOCK is supposed to be the entire process with one possible exception. Today a process can grow. Will new pages be locked? More tapdancing. And see below for System V shared memory concerns. Do not use this call for new code.

mlockall(), munlockall()
Part of the Posix REALTIME stuff. A flag controls whether or not future pages will lock.

mlock(), munlock()
A optional extention to Posix REALTIME. Individual memory pages are locked and unlocked.

Shared memory mapped into the process via mmap() is subject to the above Posix calls. An interesting question is the status of memory created by shm_open() prior to a mmap() call. Another interesting question is what if two processes are disagreeing over the status of a shared memory segment. Posix does not seem to spell these out.

Posix reluctantly mentions System V shared memory obtained via shmget() and shmat() and this is the nasty exception to the various rules. Usually these are not subject to the Posix locking calls. Instead, shmctl() controls the locking. Also a System V shared memory segment can continue to exist after all processes that had it attached have exited. And it can continue to be locked into core in this state. None of this is acknowledged by Posix.
# 5  
Old 10-10-2005
Yes, now that I think about it, it sound reasonable that an atomic IPC like semaphores could be used.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between inbuilt suid programs and user defined root suid programs under bash shell?

Hey guys, Suppose i run passwd via bash shell. It is a suid program, which temporarily runs as root(owner) and modifies the user entries. However, when i write a C file and give 4755 permission and root ownership to the 'a.out' file , it doesn't run as root in bash shell. I verified this by... (2 Replies)
Discussion started by: syncmaster
2 Replies

2. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

3. Programming

Shared Memory Between C Programs

I'm involved in a project with multiple teams which are developing C code for a Linux machine and we would like to have our program pass data to one of the other group's programs. The immediate idea is to have shared memory between the programs which would simply consist of variables whose size and... (2 Replies)
Discussion started by: cmcmanus3
2 Replies

4. Linux

Time & Memory of Programs

Hi, I have a program called "myProg" which calls two other programs "prog1" and "prog2" with system command in it. When I type ./myProg to the terminal, everything is cool. The only things that are missing: 1) I would like to measure the time elapsed when myProg runs (I do not want the... (1 Reply)
Discussion started by: hkullana
1 Replies

5. Solaris

restrcit physical memory with zone.max-locked-memory

Is it possible to restrict physical memory in solaris zone with zone.max-locked-memory just like we can do with rcapd ? I do not want to used rcapd (1 Reply)
Discussion started by: fugitive
1 Replies

6. UNIX for Dummies Questions & Answers

Are programs like sys_open( ) ,sys_read( ) et al examples of system level programs ?

Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right... (1 Reply)
Discussion started by: vishwamitra
1 Replies

7. Programming

How to deal with lots of data in memory in order not to run out of memory

Hi, I'm trying to learn how to manage memory when I have to deal with lots of data. Basically I'm indexing a huge file (5GB, but it can be bigger), by creating tables that holds offset <-> startOfSomeData information. Currently I'm mapping the whole file at once (yep!) but of course the... (1 Reply)
Discussion started by: emitrax
1 Replies

8. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

9. UNIX for Dummies Questions & Answers

Command for "Resident memory Size"

Hi Everyone.- Coul you tell me how to obtain the "Resident memory size" for any program runs on Dec TRU64 machine. What is the command in order to obtaing this value?? Best Regards Cristobal (1 Reply)
Discussion started by: Cristobal Perez
1 Replies
Login or Register to Ask a Question