2) United States Patent (10) Patent No: US 8,725,963 BL
Emelianoy et al. (45) Date of Patent: May 13, 2014
(54) SYSTEM AND METHOD FOR MANAGING A (56) References Cited
VIRTUAL SWAP FILE FOR VIRTUAL. rc eetamane
Snes US. PATENT DOCUMENTS,
2618 BIE 122008 Below ea. 700296
(75). Inventors Pavel Emliano, Moscow (RU) Kirill pane Die goes ee Pai
Korotaer, Moscow (RU), Alerander G. Zecson Bis D200 Tomas ta 104
‘ormasev, Moscow (RU) aufoasitas AL 133007 Gower ate
Spooner A> ‘T200 Shute ate
(78). Asians: Parallels IP Holdings Gb, ome
‘Schafthausen (CH) aaa
(). Notice: Subject to any disclaimer, the term ofthis Primary Examiner — Aracelis Ruiz
San cae canna nee
TISC. 1840) 133 days
6 ABSTRACT
(21) Appl. Nos 13/446,676 A.computer system has a random access memory (RAM) that
Stores cel used memory pages and SWAP song for
(22) Filed: Apr. 13,2012 storing memory page thit is not in use. Ifthe process requires
cla cation Data tmemary page str onthe SWAP sorige,ocomesponding
Related US. Application Dat pageis loaded to RAM. Ifthe page in RAM is not currently in
(60) Provisional application No. 61/475,691, filed on Apr. use, it is moved to the SWAP storage. The computer system
15, 2011. ‘has a number of Virtual Environments (i.e., Containers) that
eye ran thir own proesesa VE/Coniner RAM and vil
nt Cl SWAP strge, Te Corser proces ave access 102
GOGE 12/00 (2006.01) ‘VEVContainer RAM. When the Container process request OS
GOGE 9/46 (2006.01) for memory, the memory manager allocates memory pages in
(2) USC. the RAM andl allocates memory pages fr ihe Cnsinet
‘USPC ‘TLAAS9: 711/6; 711/104; T11/E12.016; process in the VE/Container RAM. If no free virtual RAM is
‘718/105 gyailable, the process data is moved to the virtual SWAP
($8) Fil of Castcaton Search orgs,
usec “1M6, 104,159, 718108,
‘See application file for complete seach history.
7.Claims, 6 Drawing Sheets
‘eva ate]
Ran soame
artesang
Poss
20
aaa swar
ecpng Ae
|
—
SWAP
StorageUS. Patent May 13, 2014 Sheet 1 of 6 US 8,725,963 BI
Conventional Art
410
‘Get Page Request
414
A18
‘Allocate page
420
Find Page in
LRU
‘00M
(out of memory)
Write Page to
SWAP
FIG. 1US. Patent
FIG. 2
May 13,2014 Sheet 2 of 6 US 8,725,963 BI
20 HOST
_—-_—_——— 210 —_-— 210
coma) 1 "iezycowtamesa, — —
ip address? 215 IP Address 2 |
| [user | |
Mode
| | | | late
SpaceiKemel Space merce] |
eoaeap yi woe ea y220
ea garter ata |
L Sts! Kem Le
ModeUS. Patent May 13, 2014 Sheet 3 of 6 US 8,725,963 BI
Found VSWAP
Page?
no
Find Page in
LRU
Write Page to
‘SWAP
FIG. 3US. Patent
16
4
OOM in Container
May 13, 2014
Get Page Request
Sheet 4 of 6 US 8,72
410
Find Page in
LRU
DELAY Container
VSWAP++
RSS.
FIG. 4
5,963 BI
424
426US. Patent May 13, 2014 Sheet 5 of 6 US 8,725,963 BI
210 an
560
Virtua Ades] ~\_JRAM Storage
Vet
Space
VET RAM 570. [RAM Mapping
215 Storage Quota | Nyarea
[SWAP Storage
Process 4 Quota
RAM Mapped
ve SWAP Area
VE 2 RAM
Storage Quota
¢ Virtual SWAP
580 Mapping Area
r ——
L- ‘SWAP
Storage
FIG. 5US 8,725,963 BI
Sheet 6 of 6
May 13, 2014
US. Patent
Te suvusoud
NOUoriday zy,
; a
OF pimogkes~{—]
w
9°Sld
ee
‘sa1nGoW
viva |_wvasoud
wyuooud | BE aHLO
Ze [Se sasaua
swyuooud |st / WS1SAS
Nolvorddy | ONUWaSdO
> ee
&
es
ce
Ga
ase
ve
L i +
eoepenuy Bi
suOmMeN, aed
‘S2e}00U
repos.
eornog
eBEI0IS
at
sadepy sordep)
380H
opin,
v
wn
Bulsseoo1g
wav
BE_wyyoowd
ge ssinaow
WyYDONd YSHIO
[Ze swvuooud
NOUVvoIday
bE WSISAS
ad
[=> _waisas
St onuvesdO
sz (ven
ee soa
wow),
“Rowen wershsUS 8,725,963 BL
1
SYSTEM AND METHOD FOR MANAGING
VIRTUAL SWAP FILE FOR VIRTUAL,
ENVIRONMENTS
‘CROSS-REFERENCE TO RELATED 5
APPLICATIONS.
‘This application claims priority of # Provisional US.
Patent Application No. 61/475,691, fled on Apr. 15, 2011
incorporated by oference herein in its entirety
BACKGROUND OF THE INVENTION
1. Field ofthe Lveation
“This invention relates to a method and system for memory
nanagement in virtual enviroaments, and more partiully
to a Vital SWAP for Vital Enveonments (VE), such as
Parallels Containers
2. Description ofthe Related Art
Virtalization in computer systems presents some cial
lenges with egard to memory management among isolated
Viral environments In Containeized eavionments all
Comins use te same vital memory Bach Contes can
consume the entre memory. Therefore, the amount of
memory used by the Containers neds tobe limit
Modem OS use two types o memory—andom acess
nnemory or RAM fs det accesses, but inten quanti)
and SWAP fle (slow, not dies aecesile but almost
unlimited). Typically, i' process requires memory, the OS 30
allocates some miemery from the RAM. If no fee RAM is
valle, some of the rocess-relted datas moved fom the
RAM oa SWAPfile, The dret acces rom processes to this
RAM is marked to noi he OS that the data is moved t0
SWAP fle and the RAM can be use foe storing data from 5
other process
conventional wse ofa memory SWAP files ustatedin
FIG. 1A page oquest is oceved in ste 110-In step 112,
process determines ifn RSS (resident st size a mmber of
ones curently residing in RAM) exceeds the RAM size. If 0
the RAM has some free space the number of curt esid-
ing pogesis increased instep 114andpoges allocated instep
118 Thea the memory allocation is ished instep 120
If.instep 112, itis determined hatte RAM doesnot have
free space it is checked f SWAP fle has not each the
limi (eestep 116). the SWAP lest heli th sytem
is outof memory (ep 128) andthe number of resident pages
in SWAP ile i increased in sep 126 If, instep 116, the
SWAP files under tho Limit, the pages found in LRU (est
recently sede) instep 122 andthe pags ritento SWAP 50
fleinstep 124, then the numberof resident pages isinereased
instep 126
‘When the proces attempt to coos the data tht is eur
realy resides in SWAP file the OS this data back to the RAM
an sets up he direct accesso this data again. Hosting ofthe
SWAP fle deseribed in ip *hereltap rg noe 3660.
However, one of the memory management systems that
limit memory consumption work With Containers a Vital
‘xcction environment to manage memory on a perCon-
tang basis. Aconlingly, thw a need fora system and.
method hat imitthe vil meme usage by the Containers
using SWAP fie
1s
Fa
‘SUMMARY OF THE INVENTION
s
Accontingly, the present invention is related toa system
and method for memory SWAP file forthe Container (a type
2
of Viral Environment that substantially obviates one or
mow ofthe disaivantages of the elated at
‘A computer system has a random acess memory (RAM)
that stores curently used memory pages and SWAP sorpe
for storing memory page tht isnot in use. I the process
requires memary page stored onthe SWAP storage, 3 core-
sponng page is loaded to RAM. Ithe page in RAM snot
currently in seis moved tothe SWAP storage. The com
per system has a numberof vienallenvieonmentsVES(foe
{xample,Contanes)thatran theirown processes, aVEICon-
tuner RAM ang virual SWAP storage. The Container po-
cesses have access toa VEIContainer RAM.
When the Container process requests memory from the
8, the memory manager alloates memory pages in the
RAM and als allocates memory pages forthe Conisner
process inthe VEContainer RAM. Ifno free VE(Continee
RAM is available, the process data i moved to vital
SWAP file. The VEJContiner RAM is stored in physical
RAM.
‘An aggeegate volume of RAM used by the Contsinrs in
the vital environment and bythe Host OS is diferent fem
entire acessible volume of the operating memory by a
‘olnme. The volume canbe age thn 2st or equalt9 2
The A volume is wed to cache vital swap pages i RAM
before puting them othe real SWAP are, The 8 volume can
hepre-et forthe system rit canbe set hasedon the memory
untsed by othe Containers
‘Additional fates and advantages of theinventon willbe
set fri in the deserpton that flows, an in part will be
apparent fom the desertion, or may beard by pratice
othe invention, The advantages of the invention wil be
realize and tained by thesrietire particulary poited out
in the writen description and claims hereof as Wella the
appended drawings.
Tris to be understood that both the forgoing general
dseripton and he follwing deed desertion are exem-
play and explanatory and ae intended 10 provide further
explanation ofthe invention as aimed.
[BRIEF DESCRIPTION OF THE ATTACHED
FIGURES
The aocompanying drawings, which are included peo=
vide a further understanding ofthe invention and are incor-
porated in and constitute a prt of this specification, lustrate
embodiments of the invention and together with the deserip-
tion serve to explain the principles of the invention,
Tnthe drawings:
FIG. illustrates conventional use of memory SWAP file
FIG. 2 illostates exemplary Virtual Environments (Coa-
twine) mplemented on a host
FIG. 3 illustrates using a virtual memory SWAP fil, in
socordance with the exemplary embodiment
IG. 4 illustrates the process of memory management for
Container using virtual memory, in accordance with the
exemplary embodiment:
FIG. 8 illustrates SWAP system, in aeordance with the
exemplary embostimeat
FIG. 6ilustrates an example of a computer on which the
invention may be implemented,
DETAILED DESCRIPTION OF THE PREFERRED
EMBODIMENTS
Reerence will now be made in detail 1 the prefered
embodiments ofthe present invention, examples of which are
illustrated in the accompanying drawings.US 8,725,963 BL
3
“The present invention is directed to the memory manage-
reat i Viral eavironment and more pactculely to man
agement of the per-Container memory consumption. The
‘Container, inthe exemplary embodiment, san isolated Vie-
‘ual Environment (VE), where multiple containers share ser-
vices of a single OS (and virtualize the same OS from the
perspective ofthe Conainer clients). FIG. 2 illustrates exem
plary VEs(inone embodiment, Containers, or Viral Private
Servers, such as marketed by Parallels, the assignee ofthis
application) implemented on a host compute.
Bach Container 210hasits own virtual address space ori
‘ownse of addresses), which includes memory. IP addresses,
dlisk drive addresses, SMB network names [WHAT 1S
SMB2], TCP names, pipe names, te. Eeeh Container 210 has
its own objects 220 and data structures. Bach of the objects,
220 and the data structures of each Container have a unique
identi ina context of the operating system keme} 230,
Kem! abstraction layer 216 serves as an interface between
userspace 225 and kernel space 230, for vetualizing the OS,
The VENContainers share the Kemel and request services
from the kernel using an API or similar mechanism
Bach Container 210 cannot affect data stctures oF anther
‘Container, or objets of another Container, and cannot access
information about processes running on another Container
Each Container 210 includes isolation of addres space of
‘each user fromaddeess space ofa useronany other Container,
isolation of server resoures for each Container, andisolation
‘of pplication program failure effets on any other Container.
‘The server resources include any ofa virtual memory all
‘cated to each use, a pageable memory’ allocated inthe OS
kernel to support the Containers, a pageable memery used by
the OS kere for suppor of ser processes either in shared or
in exclusive fom (ether in support of user processes of
‘one Container, or in Support of user processes of multiple
‘Container 8), a resident memory allcated inthe OS kere,
Physical memory used by the user processes, a share of CPU.
resources, security descriptors (or other identifiers related to
the rights ofthe users and the Containers), objects and data
structures used by the OS kernel, VO interiees and their
utilization level by he particular Container, file andor disk
space, and individual use resource limitations
ach Continer 210 typically includes a plurality of pro=
‘esses 215, each with at least one thread servicing corre-
sponding users, a plurality of objects associated with the
plurality of treads «set of ser and group IDs that unique in
the context of a Container corresponing to users and groups
‘of a panicular Container, a st of configuration stings coe-
responding o cach Container stored witkia the Container and
slcorresponding set of configuration settings forall Container
s stored bythe kernel, unique file space, means for manage-
‘meat ofthe particular Container, means for management of
services offered by the particular Container ta is users, and
means for delivery oftheservces to theusersof the particular
Container,
Accoaing to an exemplary embodiment, when the Con-
laine process 213 request OS for memory the memory man
ager allocates memory pages in the RAM and aso allocates,
remary pages for the Container prcess ia the VE/Containet
RAM.
Ifo free VE/Container RAM is available, the process data
is moved toa virtual SWAP file. The VE/Container RAM is,
storedina physical RAM. Anaggregate volume of RAM used,
by dhe Containers (VES) and by the Host OS isfferent from,
‘entire acessible volume of the operating memory by A vol
ume, The & volume can be larger than 20 oF equal 1 Ze,
“The volume together wih the real volume ofthe SWAP fle
isused forthe real SWAP fie. The volume canbe pre-set for
s
4
the system or it ean be set hase on the memory unused by
other Containers. The present approach thus handles RAM
quota for each container. Indeod, the & may be used for
coching swapped data and thereby increase the speed of lO
operations. If the pages in have to be moved tothe Con=
tainer’s RAM, itis not copied Instead, itis unmapped from
Virtal swap and mapped to RAM of container.
Acconding to the exemplary embodiment, the perCon-
tainer amount of available RAM and SWAP file space are
configured and the per-Contaner memory consumption is
‘managed, When a Container hits its RAM Til, the data stays
in RAM, but the direct accesso its reconfigured naif the
S kernel thatthe Container fas reached the limit. Later,
when there is no RAM left (Le. dhe actual RAM is fll, as
‘opposed tojust the Coataine allocated RAM being full), this
data is moved wo the SWAP fle.
‘When a Container process accesses the data which s not
socessble directly, the data is not moved back 10 RAM,
Instead, just the dwt access is eturned back. The SWAP
limits no global and itis set per-Container. The process tobe
notified i selected from the respective Container
FIG. 3 illustates using a vital memory SWAP file, in
secordance with the exemplary embodiment. page request
is receive in step 310, In step 312, process determines if 2
umber of pags currently residing in RAM exceed the RAM,
size. the RAM has some fee spe, the mumber of curently
residing pages i increased instep 316 and pages allocated in
sep 318. Then the memory allocation is finshed in step 320,
ip instep 312, its determined that the RAM dos nat have
any free space, the system cheeks if SWAP file has not
reached the limit (ee step 314). Ifthe SWAP file is atthe
limit the system is out of memory (step 326) and the number
of resident pages in SWAP fle is inreased in step 330.1 in
sep 314, the SWAP file is under the limit, in step 322, the
process determines if page is found ina virtual SWAP file
ke pages found, the pageis writen to SWAP fein step
328 ands number of curently esiding pages is increase in
sep 330. fae page is nt found in virtual SWAP file i step
322, the process finds the page in LRU (last recently used
$i) in step 324, and the page is writen to SWAP fie in step
328, andthen the numberof resident pagesisineresedin step
330
FIG. 4 illustrates the process of memory management for
Container using viral memory. in accordance with the
exemplary embodiments shown in FIG. 4, pagerequestis
received in step 410. In step 412, process determines if a
ruber of vial pages curently residing in VE/Container
RAM exceed the VECContainer RAM size. If the VEICon-
tainer RAM has some fee space, the number of curently
residing pages is increased inslep 422 and pages allocatedin
sep 424. Then the memory allocation is finshed in step 426,
If in step 412, the system doterminos thatthe VEICon-
tainer RAM doesnot have any free space the system checks
if Viral SWAP fie has not reached the Limit (see step 414),
I the vistual SWAP file is atthe limit (or the particular
Container) tne Containers out of memory (step 416) andthe
number of pages (VRS) currently residing in the vital
SWAP fleis increased in sep 420. If instep 414, the viral
SWAP file is under the limit (or the particular Container, in
step 418, the system finds the page in LRU (last recently
used) list of pages. The Container is delayed (i. briefly
suspended) in step 420 and a numberof curently residing
virtual pages is increased inthe viral SWAP file in step 430,
Ina conveational situation, when pages are swapped outof
RAM to the disk, there is 2 delay caused by a dis that
normally operates moch slower than the RAM. Inthe exem-US 8,725,963 BL
5
lary embodiment, swapped out page is moved tothe RAM
Tater dnt the disk. Thus, the delays associated With the
page SWAP ae mach shore.
Therefore the behavior af the SWAP s different in terms
of te tine required), andthe page SWAP is delayed ate
cially using the CPU scheduler (he the scheduler does nt
sive time fo the tread until some fture point in time, 3s
‘would have happened if this were an ordinary SWAP), The
(8 schofulr fades the CPU schluler, alinugh a prooo-
rein viral swap supporting software ives a command to
the scheduler to delay the task inside Contsineets) Note that
‘each Container can have is ova viewal SWAP file limit
In, the RAM quot is assigned tothe container by an
Amin ory using physical node rales which inal st
up by an Admin as wel), RAM size for vital swapping is
used forall containers then
FIG. § illustrates @ system according to the exemplary
‘embodiment. VES (ContainersVE 1 and VE 2) 210 ran in
usermode also shownin FIG. 2. Bachothe Containers 210
has processes 245 that ran within each VE (Container) 240
VEL hasan allocated VE 1 RAM storage quota $20and VE2
hax anallocated VE 2 RAM storage quot 880 located within
viet adres space 810, The vital storage space also has
presallocated SWAP storage quota $30 and RAM mapped
SWAP area 840.
‘The RAM storage quotes $20 and $80 are elected by the
RAM mapping are 890 located on RAM store S60. Sa
RAM is mapped tothe host or to ¥ps0. Quoted RAM is
nnapped oP processes. virtual SWAP mappingarea 588
is ako located on the RAM storage 860 The vital SWAP
mapping area 888 contains SWAP storage 59
system process determines ifa number of virwal pages
ccurealy residing in VE RAM storage quotas 820 and 580,
‘exosed the sie ofthe vital adres pace S10 the vital
adress space 510 as some fee spe, the number of cur
rely residing pes sinereased and page is allocate
the system determines thatthe vir address spce des
sot ave any fe space, the system checks if the Vital
SWAP storage quota $30 as not reached the init If the
viral SWAP storage guta $30 i at the limit (fr the Con-
tance) tbe Coane out of memory and the auaber of
ges curenly residing inthe viral SWAP sorage S30 is
increased. the virtual SWAP storage quot $30 is udr the
limit (or the Contin, the system finds the pape in LRU
(Lest recently us) ist of poges. The Containers delayed
ana numberof curently residing viral pages is increased
inthe view SWAP storage 590.
“Those sie i the at will appreciate hat system and
method of the exemplary embodiment mit the vital
memory use bythe VES, such as Consiner, by advan
soul using the SWAP feo sorane
“The model described above can be extended 19 contol
‘other types of memory in a Container For example, on
standalone LINUX box, special attention is pa 0 so-called
“diay” and“ writeback” memory. Diy pages athe amount
‘of data that shouldbe fused on disk ypically these are disk
‘ache pages that were modified), The writeback pages are the
memory hats cutenlly being writen to disk (in mostcases
this is fonneey “ity” memory)
Lins ke! memory management acount fr these 90
memory typesto improve various activites within the ker
“The “diy” memory accounting is required to prevent Denia
‘of Seevice attacks when some sp constantly Wetes data ato
page cache
The “wrtebock” memory accountng used for the same
Sushi the memory reclaiming cove (which sans the men
tioned LRU list find out what pages to fee) prevent
s
Fa
6
Jveocks onblck layer. Having perConainer management
of memory ia.a way described befor allows accouating for
beh mentionod “dy” and “writeback” memory to provide
the same QoS for containers as Linux kemel provides for
standalone boxes. This Wa; when one Conainer goes overs
limit for dity memory, other Containers dry limits an be
used, so tht the over imitis preserved. This canbe done
transparently tothe Containers themselves.
‘On NUMA systems (Non-Uniform Memory Acces, see
hiip**/msda:microsoftcomien-sTibray!
ims1781449628v~sql 1059429.5px,incomporated herein by
reference) when a lsk migrates from one NUMA node 0
anh, the LINUX kere alo moves the memory tht his
taskusesfomitsold node tthe new one. Inoderto preserve
the LRU order ofthese pages, a complex procedure is sed —
the memory s marked 35 “nt present fr this isk and then
the pages are moved on-demand, when atask stars accessing
it
With per-Contsinee memory management as described
herein, its posible to migrate the whole Container fom one
node to anmiber while preserving its LRU state—the LRU
onder is lea known, an thus can be simpy opie rom
one NUMA node to anther. The LRU list stored oe each
Cones, rather than forthe etre node
‘Asa fuer option, the memory management desribod
herein canbe use fora eeboolss upgrade”, which check.
points Contsine to RAM and thea replaces an od Kemel
With a new one. The perContiner memory mandgement
allows finding the Contine's memory tin in RAM in an
easier way. Knowing which exact new page a particular con-
liners using permits to quickly detec aes relate to con-
tener and move them fom quotaed RAM to the SWAP,
without scanning page tables relat to ceasin asks.
With reference to FIG 6 an exemplary systens for imple-
seating the invention inches gene purpose computing
device inthe form of ahost computer ora server 20or belie,
including a processing unit 21, a system memory 22 and a
system bus 29 that couples various system components
incloing the system memory tothe processing unit 2.
“The system bus 23 may be any of several types of bus
stnitures including a memory bus or memory controle, 3
Peripheral bus, an Toc bs using sy f a arty of bs
architectures, The sysem memory includes @ read-only
‘memory (ROM) 24 and random acces memory (RAM) 25.4
baie inpuvouput system 26 (BIOS), contsining the Basie
routines tat help to transfer infomation between the ele-
ments within the personal compte 20, such as during iar
ups stored in ROM 24
“The computer 20 may further inlude and disk deve 27
forreaing fom and writing oa hard sk nt shown bern
2 magntic disk drive 28 for reading fom oF Weng (0 4
remotable magnetic disk 29, and an optical disk dive 30 for
reading fomr writing oa removable optical disk 1 suchas
aCD-ROM, DVD-ROMorathe optical mea. Thad sk
dive 27, mgnetic disk dive 28, and optical dik dive 30 are
connected to the system bus 23 by a hard dik dive interlace
432, a magnetic cis drive interface 33, and an optical dive
imerace 34, respectively:
“The drives and thee associated computerrcadsble media
provide non-vlaile storage of computer readable instuc-
tions, data statutes, program modules and other ta forthe
personal compute 20. Although the exemplary environment
Ueserbed herein employs hard disk removable magnetic
€isk29 and a removable optal disk 3, it shouldbe appre-
ciated by those skilled inthe at that other types of computer
readable masa that can store data that is accessible by a
computer, soc as magnetic castes, Mash memory catUS 8,725,963 BL
1
Aig video disks, Bemouli cards, random acess
removes (RAMS). readonly emotes (ROMs) andthe ike
may also be used i the exemplary operating environment
‘A number of program modiles may he stored onthe had
sk, maunete dik 29, optical disk M, ROM24. RAM28,
incloding an operating system 35 (eg, Microsoft Win-
ddowst™ 2000). The computer 20 inludes file system 36
stoi with or includ within the operating sytem 38,
suchas the Windows NT™ Fie System (NTS), one ce more
aplication programs 37, oer program modules 3nd pro~
gam data 38. A user may eter commands and information
‘nthe personal computer 20through input devices such sa
Keybrd 40 and pointing device 42
‘Other inut devices (oot showa) may include a micro
phone, joystick, game pad, satellite dish, scanner othe ike.
‘These and other input devies ae often connected to the
processing unit 21 through a serial port interface 46 that is
‘coupled othe system bus, and they may also beconnested by
‘otherintriaoes, such as parallel oa game por oF univers
seralbus (USB).A mentor 7 or other ype of display device
isalso connected he system bus 23 vio aintriace suchas
«video adapcr 48 In adton tothe monitor 47, personal
‘computers ypcally include other prihecal apt devies
{oot shown), suchas speakers and printers.
The personel computer 20 may operate ina networked
‘wiroameat using logical connection te one or more remote
‘computer 4, The emote computer (or computers) 49 may
he another personal compute, a server, a router, a network
PC, a peer device of other common network node, a
typically includes some oralofthe elements deseriedabove
relative tothe personal computer 20, although here only a
memory storage device 80 i ilustrated. The logical connoe-
tions include a local area network (LAN) 81 anda wide area
newark (WAN) 2, Such netrking environments areca
non inofics, entemprise-vide computer networks, Innes
andthe Inert.
na LAN cavizonment, the personal computer 20s om
nected t the ol network 1 throvgh a actor nterace oF
‘apt 53. When used in a WAN networking environmen
the penonal computer 20 typically includes « modem $4 or
‘other mca fe establishing communications aver te wide
area network 2, such asthe Inter. The mode 4, which
tay be internal extemal, isconnecedo te systom bus 23
athe sec ort interfae 46 na networked enviroment,
the progrim modules depicted eelaive to the personal can
puter 20, or portions thereof, maybe stored inthe remote
memory storige device. It wil be appreciated that the net
work conacctions shown are merely exemplary aad other
means of enablishing @ communications nk between the
computers may be used.
Having thus describe prefered embodiment sould
be apparent to those lle a heat that eran vantages
‘ofthe described method and apparatus have bon achieved. It
shoul also be appreciated that various meaifeations, aap
tations, and alterative embodiments thereat may be made
within the scope and spit of the preseat invention. The
invention is farter defined by he following claims
‘What is claimed is
4A.sytem for shariag memory among ile Contain
es the system comprising
snaperating system (OS);
random access memory (RAM forstorng curently used
‘emry pgs:
a SWAP storage for storing memory pages that atv cu
really notin se;
«plurality of Vitul Environments (VES) runing under
the OS, and sharing services ofthe OS,
s
8
atleast one VE process running in each VE;
2 VE RAM implemented under the OS;
a virtual SWAP storage implemented under the OS
‘a memory manager that pawides acess tothe RAM by
the VE process;
wherein:
‘when the VE process requests memory from the OS, the
‘memory manager allocates memory. pages inthe
RAMandallocates memory pages forte VE process
inthe VERAM,
ifthe VE RAM bas no fre space, the VE process pages
are moved tthe vital SWAP storage,
ifthe VE process requires a memory page stored inthe
virtual SWAP storage, the page i loaded tothe RAM,
and
ifthe process page inthe RAM is notcurreatlyinuse, the
‘paz is moved tothe SWAP storage,
‘wherein, ifthe memory page required by the VE process
is not inthe virtual SWAP storage, a system process
finds the memory page na Jest recently used set and
writes ito the SWAP storage
2. The system of claim 1, wherein per-VE amounts of
available RAM and the SWAP storage spaces are pre-config-
ured.
3. The system of ela 1, whereina page SWAP is delayed
anifcially by a CPU schesile,
4. Asystem for sharing memory among maliple Contain
ers ina virual eavironment, the system comprising:
‘a processor;
‘a memory couple to the processor,
‘8 computer program logie stored in the memory and
‘executed on the processor fr implementing the:
launching an operating system (OS);
storing curenly used memory pages in a random access
memory (RAM):
storing memory pages that are curently not in use in @
SWAP storage:
launching plurality of Vital Eavironments (VES) under
the OS, wherein the VEs share services of the OS;
‘wherein atleast one VE process running in each VE;
Wherein each VE accesses a VE RAM:
Wherein each VE aocesses a virtual SWAP storage imple-
mented under the OS;
wherein a memory manager provides acess to the RAM
used by the VE process
allocating memory pages in the RAM and allocating
memory pages forthe VE process in the VE RAM when,
the VE process requests memory from the OS,
‘moving the VE process pages to the vetal SWAP storage
if the VE RAM has no foe space,
loading a memory page into the VE RAM ifthe VE process
requires a memory page stored in the viral SWAP
storage, and
‘moving memory page othe SWAP storgeifthe memory
poe in the VE RAM isnot curently ia use,
hea the memory page required bythe VE process notin
the virtual SWAP storage finding the memory page ina
least recently used set and writing itt the SWAP stor-
45. A-system for sharing memory among multiple Virtual
Enviroaments (VES), the sytem comprising
‘ost operating system (OS):
‘arandom aoess memory (RAM) forstoring curently wed.
memory pages:
a SWAD Storage for storing memory pages that are cur.
reatly nt in use
«plurality of VEs running under the host OS;US 8,725,963 BL
9
atleast one VE process running in each VE;
‘VE RAM implemented under the host OS;
‘viral SWAP storage implemented under the OS: and
‘a memory manager that provides the VE process access to
{eRAM
‘when the VE process requests memory from the host OS,
the memory manager allocates memory pages in the
RAMandallocates memory pages forthe VE process
inthe VERAM,
ifthe VE RAM has ao fre space, the VE process pages
are movad tothe virtual SWAP storage,
ifthe VE process requires a memory page stored inthe
virtual SWAP storage, the page is loaded tothe RAM,
and
ifthe process page in the RAMis not curently inuse, the
‘pg is moved tothe SWAP storage and
ifthe memory page required by the VE proces is notin
the virtual SWAP storage, a least recently used
memory page is written othe SWAP storage.
6. The system of claim 8, whercin the VEs are Virtual
Private Servers.
T.A method for sharing memory among enultiple Virtual
Environments (VEs), the method comprising the steps of
launching an operating system (OS)
storing curently used memory pages ina random aocess
memory (RAM):
Fa
10
storing memory pages that are curealy not ia use in @
SWAP storage;
Janaching a plueality of Vial Eavironments (VES) under
the OS, wherein the VEs share services of the OS;
‘wherein at least one VE process running i each VE;
‘wherein each VE accesses a VE RAM:
‘wherein each VE accesses a vrttal SWAP storage imple
mented under the OS;
‘wherein a memory manager provides access tothe RAM
used bythe VE process
allocating memory pages in the RAM and allocating
‘memory pages forthe VE process in the VE RAM when
the VE process requests memory fram the OS,
‘moving the VE process pages to the vctal SWAP storage
ifthe VE RAM has no free space,
loading a memory page into the VE RAM ithe VE process
requires a memory page stored inthe viral SWAP
storage, and
‘moving a memory page tthe SWAP storage ifthe memory
page inthe VE RAM isnot currently in use,
‘when the memory pagerequzedby the VE process is natin
the virtual SWAP storage, finding the memory page ina
least recently used set and writing itt the SWAP stor-
age.