This is an interview question. How to detect and find out if a program is in deadlock? Are there some tools that can be used to do that on Linux/Unix systems? My idea: If a program makes no progress and its status is running, it is deadlock. But, other reasons can also cause this problem. Open source tools are valgrind
In what context Kernel Thread runs in Linux?
I am newbie to Linux Kernel. I know that there are two context 1. Process Context, running in user space or in Kernel Space (for ex: as part of System call) 2. Interrupt Context In what context Kernel Thread (not related to any User Thread, for ex:flush task) runs ? Is there any other context other than Process and Interrupt
IFS usage in bash
I have I think I understand whats happening in 2nd and 4th for loops. But I do not understand why 1 was not printed in 1st and 3rd for loops. The whole idea of IFS is confusing to me in general. Answer When you say $var_name then 1 is interpreted as a separator and hence you see the string as
How to wait for the dd command to finish copying before continuing my script?
Title pretty much nailed it, Im copying files to a flash drive and then doing some things to those files. Well I have noticed that after running the dd command the flash drive is still flashing and not all the files are on the device. Does anyone know how to maybe run a simple loop (in script) to wait on
starting apachectl from bash
I am writing a bash file. I need to start apachectl from my bash file. so i wrote: When I run it with root, an error occurred: I searched and I found that, I should be super user with su – not su Now, I want to know: why this error occurred? How could i run it with su? Answer
Convert MediaWiki wikitext format to HTML using command line
I tend to write a good amount of documentation so the MediaWiki format to me is easy for me to understand plus it saves me a lot of time than having to write traditional HTML. I, however, also write a blog and find that switching from keyboard to mouse all the time to input the correct tags for HTML adds
iMacros + FF : Linux, command line
I want to run iMacros script with Firefox, under Ubuntu, by specifying the script in the command line. Unfortunately, the browser only opens the file as text and not runs it… Any clue? Answer You should manually add the macro to your browser then save it under a name of your choice. Then you can call it with
Fixing file permissions after modifying in C++?
I’m saving my data in the executable file of the program. I copy it to a temporary file, overwrite a part starting at a ‘magic string’ and rename it to the original. I know this is a bad idea, but I’m doing it just for experimenting. I got everything to work so far, except for that I have to re-enable
What is %gs in Assembly
void return_input (void) { char array[30]; gets (array); printf(“%sn”, array); } After compiling it in gcc, this function is converted to the following Assembly code: push %ebp mov %esp,%ebp sub $0x28,%esp mov %gs:0x14,%eax mov %eax,-0x4(%ebp) xor %eax,%eax lea -0x22(%ebp),%eax mov %eax,(%esp) call 0x8048374 lea -0x22(%ebp),%eax mov %eax,(%esp) call 0x80483a4 mov -0x4(%ebp),%eax xor %gs:0x14,%eax je 0x80484ac call 0x8048394 leave ret I
Run a persistent process via ssh
I’m trying to start a test server via ssh but it always dies once i disconnect from ssh. Is there a way to start a process (run the server) so it doesn’t die upon the end of my ssh session? Answer As an alternative to nohup, you could run your remote application inside a terminal multiplexor, such as GNU screen