Reserve resources (memory and processes)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reserve resources (memory and processes)
# 1  
Old 09-16-2010
Reserve resources (memory and processes)

I have a shell script which sets some variables and then calls modules of a program in succession, one by one. Problem is that the script is executed on servers with many users, so sometimes the script starts running, runs for 10 minutes and then breaks due to lack of resources when other users run memory intensive processes.

So, I have an assignment to somehow reserve enough memory when the script is started, so that memory problems are avoided. Also, is there a way to reserve certain number of processes? I don't need a complete solution, just an idea to get started is enough.
# 2  
Old 09-16-2010
From the sounds of it you're on Linux, and running into the OOM-killer when things get tight. Correct me if I'm wrong.

Preallocating memory won't prevent the OOM-killer from hitting you, if anything, hogging more memory and more processes will put you higher in its list. Band-aiding a fix onto your scripts won't stop the server from running out of memory anyway, at best it'll deflect the OOM-kill to something else. What would they rather have die, your scripts, the memory-intensive processes, some daemon, or things more system-critical? They need to add more memory and/or swap, or to start restricting the stupid users that keep bombing the system.

One way to "preallocate" memory in a shell would be to make and clear a large shell variable, I suppose, but that's subject to the max size of a shell variable in your shell and all kinds of hackish and ugly and unlikely to work:
Code:
MEMHOG="$(dd if=/dev/zero count=1024 bs=1024 2> /dev/null | tr '\000' 'a')"
MEMHOG=""


Last edited by Corona688; 09-16-2010 at 12:44 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

AIX memory usage by processes

Hi, i have 2 identical web servers using AIX. I use nmon analyser to check their performance. The server A exceeds 20% memory usage for system, 5% for cache and the rest 75% for processes. While, it uses 4% of Paging Space. The server B exceeds 20% for system, 45% for cache and 35% for processes.... (24 Replies)
Discussion started by: dim
24 Replies

2. Programming

JVM processes are not getting memory allocation as soon as started

Hi, i have this scenario, when i start about 20 java processes simultaneously in unix and run ps -eaf command i can see that processes are running but memory is not getting allocated to them immediately and it stays ideal for at least 10-15 min. Meanwhile i run free command to check the RAM,... (5 Replies)
Discussion started by: Vishal Gangrade
5 Replies

3. Shell Programming and Scripting

List processes using my memory

Here is the output of top command So you see 99% of memory is in use -> Mem: 66005468k total, 65662548k used, How can I find out all processes consuming this 99% memory in descending order of consumption i.e. starting with processes eating more memory. I need the total of the output to... (3 Replies)
Discussion started by: mohtashims
3 Replies

4. Red Hat

Best way to monitor use of memory resources for an RHEL instance

I wanted to know what is the best way to monitor use of memory on an RHEL server. We have 16 GB of memory for the RHEL instance but the usage at any time is more than 99%. I use /proc/meminfo on the server to check memory. I hope, my question is clear that what is the best way to monitor use of... (2 Replies)
Discussion started by: RHCE
2 Replies

5. Solaris

How get memory and cpu usages of user's processes?

I have the processes (100+) by the oracle id and I'd to get the summarized view of the oracle processes' usage of the memory and the cpu. top would give me some, but not all. Thanks (3 Replies)
Discussion started by: iwmi
3 Replies

6. Homework & Coursework Questions

processes and shared memory

Hi again! I have 2 questions ..: How can i create exactly one number of processes ? For example i want to create l*n processes and i tried this: for(i=0;i<l*n;i++){ pid=fork()} But it creates more than l*n Also, i want each child to run another x.c program with 3 command line... (1 Reply)
Discussion started by: giampoul
1 Replies

7. Homework & Coursework Questions

processes and shared memory

Hi again! I have 2 questions ..: How can i create exactly one number of processes ? For example i want to create l*n processes and i tried this: for(i=0;i<l*n;i++){ pid=fork()} But it creates more than l*n Also, i want each child to run another x.c program with 3 command line... (1 Reply)
Discussion started by: giampoul
1 Replies

8. Shell Programming and Scripting

Processes in Shared Memory

Hello , I would like to know how to check if a given process id belongs to particualr shared memory segment . Please help Thanks in advance (3 Replies)
Discussion started by: rmv
3 Replies

9. Solaris

Reserve Memory for Global Zone

We have several containers on one machine and would like to reserve some memory for the global zone. capped-memory only allows max physical/swap and setting a max on each container isn't an option. The server has 32GB physical and 30GB swap. Currently there are ten containers on it. Normally... (6 Replies)
Discussion started by: kharjahn
6 Replies

10. UNIX for Advanced & Expert Users

How to find memory and other resources in AIX

Hi, Im trying to find memory and other resources in IBM AIX. Please let me know how to do this. (3 Replies)
Discussion started by: R00tSc0rpi0n
3 Replies
Login or Register to Ask a Question