You are not logged in.
I usually run 10--12 terminals at any given time, and this doesn't take up to much memory since I can use the rxvt-unicode daemon urxvtd.
Yet each terminal has its own instance of bash, and this does take up memory.
What I wonder is whether it is really necessary for each terminal to have its own shell instance.
Obviously this is a necessity for independent history, but I really don't care too much about that.
Is there a way to run a bashd and have the individual shells hook into it? Is it even possible, or is there some consideration I have failed to make?
Maybe my workflow is flawed, I don't know.
My OCD nature prevents me from opening and closing terminals as whim, as there is a predetermined place for everything to go.
I always have the same terminals for their same respective things open on each workspace.
Some of them really don't need a complete shell though... for instance I have one to update svn and read commit logs, one for irc, and another for file transfer on my net workspace.
None of these need bash's features... I know I don't need bash underneath irssi but I do need some sort of command prompt to run my svn scripts and transfer programs.
In fact it seems most of my shells are more like command launchers, though I do want to see the output and be able to scroll back. Perhaps another shell would be better for me.
Only in a couple of my terminals do I actually use globbing and piping and such --- this is where bash is a necessity.
Of course if there was a way to hook the shells into one instance, I wouldn't feel so guilty about having so many open for so little purpose.
Also, I still don't know how to use a single terminal multiplexer, so obviously I will look into screen or tmux.
Any recommendations or insight would be greatly appreciated.
EDIT: I now know that it isn't possible to have a shell daemon, and I realize that my concern over memory usage is considered unfounded. Now I would like to know why no such program is available / why it's impossible. This is for my education.
Last edited by egan (2010-07-05 16:48:01)
Offline
Short story: yes, multiple shell instances is needed.
And they really do take next to no resources so don't bother with it.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
$ ps -Ao rss,vsize,cmd | grep bash | awk '{rss+=$1;virt+=$2}END{print "COUNT: " NR; print "RESIDENT: " int(rss/1024) " MB"; print "VIRTUAL: " int(virt/1024) " MB"}'
COUNT: 29
RESIDENT: 123 MB
VIRTUAL: 279 MB
I think this is acceptable.
Offline
$ ps -Ao rss,vsize,cmd | grep bash | awk '{rss+=$1;virt+=$2}END{print "COUNT: " NR; print "RESIDENT: " int(rss/1024) " MB"; print "VIRTUAL: " int(virt/1024) " MB"}'
COUNT: 4
RESIDENT: 3 MB
VIRTUAL: 13 MB
$ ps -Ao rss,vsize,cmd | grep fish | awk '{rss+=$1;virt+=$2}END{print "COUNT: " NR; print "RESIDENT: " int(rss/1024) " MB"; print "VIRTUAL: " int(virt/1024) " MB"}'
COUNT: 5
RESIDENT: 8 MB
VIRTUAL: 23 MB
Hmmm ... I should try this when I'm doing real work.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
I suggest dash and f.e. 'urxvtc -e htop'.
Offline
I guess I shouldn't feel guilty about ~2MB per shell.
I do wonder why exactly you cannot have multiple terminals hooked into the same shell instance. I guess figuring where stdout goes is difficult?
Offline
If you want to launch something from a shell, without having the shell "underneath", use exec:
exec irssi
Offline
% ps -Ao rss,vsize,cmd | grep zsh | awk '{rss+=$1;virt+=$2}END{print "COUNT: " NR; print "RESIDENT: " int(rss/1024) " MB"; print "VIRTUAL: " int(virt/1024) " MB"}'
COUNT: 11
RESIDENT: 14 MB
VIRTUAL: 63 MB
(Note it's zsh)
Since i switched to zsh it does take less ram and lots less startup time (i mean starting a terminal and the shell only takes maybe a second or so, not as with bash 5).
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
@ Ogion
bash in urxvt here - starts in definitely less than a second. Were you using bash-completion or what?
Offline
Oh, ofc i was using bash-completion. Also my bashrc wasn't really long, just a bunch of aliases. My zsh config now is longer than what i did to bashrc and it starts faster and uses less ram. (And comes with its lovely completion )
Ogion
Last edited by Ogion (2010-07-05 14:37:35)
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
It's nice to see zsh has a smaller memory footprint, which was kinda unexpected for me. I have been contemplating switching for a while. My bash starts instantly, but I have had to disable bash-completion to do so, otherwise it takes ~1 sec which is too slow for me .
I'd still like to understand WHY multiple shell instances are necessary --- I don't know much about the way they work. I would expect the only difficulty with hooking multiple clients into one shell would be where the stdout goes. Obviously the shell would have to keep a list of the connected clients, and the clients would need a bit of memory.
Offline
@ egan
You can background apps: bg, fg, jobs etc.
> where the stdout goes
It goes where you tell it to go, you can always redirect.
Offline
@ egan
You can background apps: bg, fg, jobs etc.> where the stdout goes
It goes where you tell it to go, you can always redirect.
Yes I know job control and such, I don't really see how that is related.
I know where stdout goes and how to redirect it --- I just wondered if that was a possible consideration as to WHY it is necessary for multiple, complete shell instances.
Why is it not possible to have one shell managing things with clients (in different terminals) hooked into it to give it commands?
Another consideration I realize is that blocking processes (not backgrounded or immediately returning) would preclude the clients from communicating with out the shell forking?
Offline
As far as i saw it as i was using it for a while, fish seems to have a daemon-client thing running.
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline