LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-31-2014, 05:17 PM   #1
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Rep: Reputation: 15
How to lock a program so that it can run only one session.


Hello all,

I want to lock the firefox software so that this software can be run only once simultaneously in one session.

For example, I use s01 thin client to get the kernel and initrd files from a server and uses some files (like firefox profiles) from the server. Once I clicked the firefox icon in the thin client, the program will run but if I click the firefox icon twice or more, the firefox process will be only one.

Can anyone help on this ? How to realize this function?
 
Old 03-31-2014, 06:38 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
You still only have one firefox binary in memory.

What happens is that the second/third click directs the first firefox to fork a new instance - sharing all code.

Only new data pages get allocated.

This is done so that the new window can pop up immediately - the only delay is the data to display.

Even if you manually run the process you will still get only one binary as long as the path used is the same as for the first instance. Only if you have two versions installed and start each one will you get a new binary load - as the path name now point to two different applications.

This is part of the normal "deduplication" done by the kernel. If the same inode is being referenced (and is already loaded) then there is no need to load a new copy - it just duplicates the memory map for the code segment, and allocates a new stack+heap (the data space), and the program starts.

In addition, it is possible (I'm not sure Firefox does this, but I ran across the feature quite a while ago) that the same firefox process just opens a new window...

Chrome does this, and just starts a new thread for each tab/window.

Last edited by jpollard; 03-31-2014 at 06:42 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable lock session (lock screen) when switch user in KDE 4.x Murz Linux - Desktop 4 12-01-2010 08:28 AM
Lock after invalid login attempts, session lock, minimum password length nstarz Linux - Security 1 06-24-2010 05:36 PM
run a program when X session ends tanoatlq Linux - Software 2 08-29-2008 03:10 AM
How to run a program in an ssh session that will run after you close out the session? dr_zayus69 Linux - Networking 5 03-05-2006 07:15 PM
Starting program remotely and have them continue to run after the session is ended OJAtkinson Linux - General 2 12-07-2004 12:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration