Strange Note in Solaris manual


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Strange Note in Solaris manual
# 1  
Old 02-19-2013
Oracle Strange Note in Solaris manual

Hello!

In document "Advanced System Administrationfor the Solaris™ 10Operating SystemSA-
202-S10"
(Solaris 10 Advanced System Administration(SA-202-S10))

I found that:


To view the current swap space allocation, complete the following steps:
1. List a summary of the system's virtual swap space.
Code:
 
# swap -s
total: 218096k bytes allocated + 20432k reserved = 238528k used, 4174456k available

2. List the details of the system's physical swap areas.
Code:
 
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0t0d0s1 136,9 16 8392544 8350448

Note - There can be a discrepancy in available and free swap space size between the
swap -s and swap -l outputs. The swap -s output does not take into account pre-allocated swap space that has not yet been used by a process.


As I understand, pre-allocated swap space is a reserved swap space. swap -l shows only swap devices itself, like swap slices and swap files. Swap -s takes into account all swapfs controlled area, i.e. physical RAM+swap slices+swap files.
What does this note means?
# 2  
Old 02-19-2013
Perhaps with lazy allocation for speed, if you do not get a page rolled out, they do not allocate it. At exec, they do reserve the swap space, since the start is a promise that it will keep running, but it can be anywhere. If you exit with all pages in ram, they are never allocated or deallocated.
# 3  
Old 02-20-2013
Okay, let's start from the beginning:

When I run a process, it reserves some memory and use a subset of reserved memory.
Kernel can put some pages of my process to RAM, but some pages to swap slice. But where are the pre-allocated swap spaces here?
# 4  
Old 02-20-2013
Quote:
Originally Posted by sluge
Okay, let's start from the beginning:

When I run a process, it reserves some memory and use a subset of reserved memory.
So far, so correct. If more memory is requested than the system has then some pages are temporarily put into a part of the disk set aside - memory got "swapped out". There are are two strategies to do this, though:

When the program starts it justs requests the amount of memry it needs. It doesn't care if the kernel can meet these demands or not. If eventually the program has to be swapped out the kernel does so, but the program doesn't care. This is called "lazy" swap allocation and because swapping should happen only very rarely it has the advantag of being fast - the program doesn't bother to prepare for the rather unlikely occasion of being swapped.

Another strategy is this: when a program starts if anticipates the possibility of being swapped out. Therefore it makes the kernel allocate the space in the swap area it might need to be swapped out at start. Once it really gets swapped out it uses this space. This is called "early" swap allocation.

The advantage of this is that the swap space can hardly become overtaxed. This is why in previous times, when memory was scarce and swapping was quite usual, this was a sound strategy. But today swapping is rarely done and allocating space in swap one probably never needs anyway is just a waste of time.

For instance the AIX (IBMs UNIX) kernel used early swap allocation until version 4.3.3 (around 2001), then switched to lazy swap allocation with version 5L.

I hope this helps.

bakunin
# 5  
Old 02-20-2013
When you run a program, everything is either:
  • mmap()'d (like libc.so). The mmap()'d pages are allocated into RAM on demand, but as they have a native disk file, they do not relate to swap.
  • put in RAM and an amount reservation in swap is made in case all the RAM needs to get swapped out. All these pages are marked dirty, as none has been swapped out. If they swap out, the first time they need to have pages allocated. Some uninitialized areas might not even have RAM pages at first, in case they are never used. In this case, when used they are allocated and marked dirty, but still no specific block of swap is allocated.
  • It is possible to have wired pages that never swap, as well, usually in the kernel. The kernel may buffer using wired pages, and active i/o wires a page.
  • Part of the process is managed in tables in the kernel. I am not sure if it is all wired or some or all can swap. May vary with OS!

Last edited by DGPickett; 02-20-2013 at 02:53 PM..
# 6  
Old 02-20-2013
Quote:
Originally Posted by sluge
Okay, let's start from the beginning:

When I run a process, it reserves some memory and use a subset of reserved memory.
Yes that is correct...
Quote:
Originally Posted by sluge
Kernel can put some pages of my process to RAM, but some pages to swap slice. But where are the pre-allocated swap spaces here?
The kernel never puts any pages to swap on process initialization...and like bakunin said it simply allocates "X" amount of swap in case it were to be swapped out in the near future. That used to be the way things were done...newer systems have pseudo swap where physical memory if in abundance is reserved instead of swap...because it is faster.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Set password in bash script without manual entry-Solaris 10

Hi I have a root script which is setting up user and his dirs and so on. After I create user and set up all the necessary I have to manually set user password. I try all possible ways what google find me and nothing works for me. If maybe one of you have a solution for my problem it will be... (1 Reply)
Discussion started by: Jaffakeks
1 Replies

2. Programming

Strange "getsockopt" Solaris behavior

Please take a look on following code: s = socket(PF_INET, SOCK_STREAM, 0); //socket fcntl(s, F_SETFL, O_NONBLOCK); //set socket to nonblock retry_conn: ret = connect(s, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr_in)); // try to connect, for sure... (7 Replies)
Discussion started by: revolta25
7 Replies

3. Solaris

Strange folder on Solaris zone

Hi, One of the file system is getting full and I was trying to do some housekeeping. I can see two logs directory, I am not sure how to fix it. if I go inside it, it goes inside smaller one root@pdrpd01-ddp01:/# cd /ltd/apps/LOTM/TeamCDC34/TeamInvest... (6 Replies)
Discussion started by: solaris_1977
6 Replies

4. Solaris

Strange value in poolstat or Solaris

I have Solaris-10 (Update-9) Sparc server. I am noticing some strange behavior on poolstat output. As per below output, size is 64. Though load is very less for pool_OAG, it should be less ideally. It seems like it is not releasing resource, it seems ? root@pdrtop01:/# poolstat -r pset id pool ... (0 Replies)
Discussion started by: solaris_1977
0 Replies

5. Solaris

Strange isuse with shared storage in Solaris 10

i have luns offered by SE3310 being mounted on two T2000 servers (sun solaris 10u11) . i can see the files on both servers but if i create a new file or rename n existing file on one node its not immediately visible on the other unless i unmount n remount the partition ..how can i fix this ? (2 Replies)
Discussion started by: aliyesami
2 Replies

6. Solaris

Strange thing with solaris ls on nfs shared directory

I shared from linux server a dir with nfs3,solaris mount ok,and can tar files,but if i do ls or cp.. on mnt i have mount the nfs share root@solaris: mnt $ touch 2 root@solaris: mnt $ ls -lh ls: can't read ACL on .: Permission denied root@solaris: mnt $ ls 1.tar 2 root@solaris: mnt $ cp... (4 Replies)
Discussion started by: Linusolaradm1
4 Replies

7. Solaris

Strange df output on solaris 9

Hi all, After deleting some large log files on solaris 9 machine I can see strange df output shows below /dev/vx/dsk/rootvol 45G 16384E 50G 39879076698694% / I thought it will back to normal once I restart it but did not. I have seen in sunsolve article 6362734 that "Solaris 8... (0 Replies)
Discussion started by: rajashekar333
0 Replies

8. IP Networking

Strange network behaviour in Solaris 10

Hi folks how can this be explained? Cheers Spacerat ---- tom@jumpstart:~$ cat /etc/resolv.conf domain acceleris.ch nameserver 192.168.21.230 tom@jumpstart:~$ nslookup Google 192.168.21.230 Server: 192.168.21.230 Address: 192.168.21.230#53 Non-authoritative answer:... (2 Replies)
Discussion started by: Spacerat
2 Replies

9. Solaris

solaris 10 strange df output

hi, in solaris 10 SUN SPARC V245 server the following df -h output is showing . can i reuse the following disk space by deleting them /platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1 20G 5.2G 14G 27% /platform/sun4u-us3/lib/libc_psr.so.1... (2 Replies)
Discussion started by: phani.madiraju
2 Replies

10. Solaris

strange problem regarding zip/unzip from window to solaris machine

Hi , I faced a very strange problem when I unzip a zip file on my solaris workstation. Actually I wanted to transfer a folder, say it TEST which contains some sub-folders inside it from windows to solaris machine. So I zipped this folder to TEST.ZIP on my windows machine. Then from my... (11 Replies)
Discussion started by: Raj Kumar Arora
11 Replies
Login or Register to Ask a Question