Operating System - HP-UX
1834287 Members
2002 Online
110066 Solutions
New Discussion

Re: Atomic shell-level commands

 
Sajith Abeyanayake
Occasional Contributor

Atomic shell-level commands

It's my understanding that the action of mkdir(1) is about as close as one can get to a mutex at shell level. Then I also heard that the ln -s (i.e. create a symlink) had this property also.

(a) Is this the case?

(b) If ln -s is (more or less) atomic, then so too is the action of ln by itself (i.e. creation of a hard link)?

tks
1 REPLY 1
Muthukumar_5
Honored Contributor

Re: Atomic shell-level commands

Depends upon the directory permission/ owner ship/ groups directories ( files) can be given permission to access.

how are u specifying mutex over there in mkdir / ln commands?

ln -s will create a softlink to another directory / files without having full contents. It can not be used over NFS
if the file is not in the mounted / exported limits

hard link will contains the contents and link to the file.

hard links vs soft links

Master1 # cat > /tmp/test1.ls
hai
bye
Master1 # ln -s /tmp/test1.ls /tmp/test2.ls
Master1 # ll /tmp/test?.ls
-rw-rw-rw- 1 root sys 8 Aug 19 11:14 /tmp/test1.ls
lrwxrwxrwx 1 root sys 13 Aug 19 11:15 /tmp/test2.ls -> /tmp/test1.ls
Master1 # cat /tmp/test2.ls
hai
bye
Master1 # ln -f /tmp/test1.ls /tmp/test3.ls
Master1 # cat /tmp/test3.ls
hai
bye
Master1 # mv /tmp/test1.ls /tmp/test4.ls
Master1 # cat /tmp/test2.ls
cat: Cannot open /tmp/test2.ls: No such file or directory
Master1 # cat /tmp/test3.ls
hai
bye

Easy to suggest when don't know about the problem!