APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > News Posts > Mac OS X swap, swapping, paging
Printer Friendly Version




News Group Posts

Mac OS X swap, swapping, paging




From: Anthony Lawrence <tony@pcunix.com>
Date: Sun Feb 9, 2003  1:44:41 PM US/Eastern
Subject: Re: Defrag OSX (special case)

[[ This message was also posted as:
    <090220031344405215%tony@pcunix.com> ]]

In article <090220031023424926%nospam@iam.invalid>, Mark Conrad
<nospam@iam.invalid> wrote:



> In article <lor1a.40985$2H6.328@sccrnsc04>, Tony Lawrence
> <tony@pcunix.com> wrote:
>
>> However: for most people, the default situation works out fine and 
>> since
>> the swap file was created at first boot, it wouldn't be fragmented, 
>> and
>> subsequent disk activity wouldn't affect it.
>>
>> As you obviously have a spare disk, your best bet would be to dedicate
>> an appropriately sized partition there for swap.
>
> I plan to move my swap files <plural> - to another another spare disk,
> as soon as I learn how, because most of the file-fragmentation occurs
> in the swap files, or so I am told.

Unless you have multiple disks, the best way to manage swap is one
single partition dedicated to whatever you need.  Having multiple swap
files has no advantage unless you can put them on separate disk drives.

>
>
>> So what you are actually talking about is swap.
>
> Mostly, yes, but I would still like to observe a map of an inactive
> UFS-partition to satisfy myself that UFS disk-management is all that it
> is claimed to be as regards to file fragmentation.

>
>> There's no concern about fragmentation of
>> your fs because swap then isn't part of your fs at all.
>
> I hope when you refer to fs that you mean all files in the entire disk
> space, and not just those files that are created in a UFS partition
> when the partition is freshly "initialized", before OSX is even
> installed.

I have NO idea what you mean.  I suspect you are still misunderstanding
swap.

>
>
>> The simple answer is that you decide how much you will need, and
>> dedicate a partition to it.  There's no concern about fragmentation of
>> your fs because swap then isn't part of your fs at all.
>
> It isn't that easy, when it comes to Lisp applications.
>
> Let me explain -
>    First, let me rant and rave a bit about the mind-set of languages
> like C/C++.   The whole idea of those languages is efficiency, so the
> programmer himself is responsible for assigning swap files, assigning
> and later releasing ram (manual garbage-collection or "GC") - by using
> C constructs like malloc, and in general trying to anticipate ahead of
> time what the programs will do and therefore come up with a Grand
> Scheme, all this ahead-of-time.














Completely untrue.  The programmer does NOT assign swap.
>
> Such is the nature of imperative languages like C, and it works fairly
> well as long as highly skilled C programmers are involved.

VM management has absolutely NOTHING to do with C, Lisp or indeed any
programming language.  It's a function of the OS, not your program.

>
> Lisp is completely different, mind-set wise.  The idea of planning the
> Grand Scheme of a program ahead-of-time is a foreign concept to a Lisp
> programmer.  For example, I can't assign swap files ahead of time
> because it is unclear ahead-of-time if they will even be used by the
> "main" program, how large they should be, and other necessary details.
>
> Lisp programs deal with unknown quantities, so the whole idea of
> pre-planning doesn't work well at all. (including assigning swap files)
>
> The reason for using Lisp is generally to tackle a problem which no one
> knows whether the problem can even be solved or not - - - too many
> unknowns, which would drive a C programmer crazy because a C program
> _has_  to be pre-planned in many respects.

You are very, very confused.

>
> Oh sure, I could employ Genetic Programming (GP) to create programs
> which actually "create" other programs on-the-fly, (even capable of
> creating C programs by using CPS techniques) - something like an
> automatic computerized "human" programmer inside my computer, who
> handles the dirty-work of creating the actual desired final program - -
> - in fact I have created "toy" program-writing-programs in the past.
>
> Such GP programs can spawn multiple other programs, which could easily
> overwhelm ram and disk space.
>
> Not even the creator of the "main" GP program knows ahead of time what
> "satellite" secondary programs the computer will decide to create once
> the main Lisp program is started.
>
> .....but the concept of creating "real-world" Genetic Programming
> (program-writing-programs) is definitely the realm of Lisp experts like
> Paul Koza, not me.
>
> I was just explaining something about Lisp in general, with the hope
> that you might understand better why pre-planning things like
> swap-files might not work for me.
>
> Does any of this make sense to you.

You are confused.

First of all, in the best of all possible worlds, you wouldn't have
swap at all because you'd have enough RAM to satisfy every
application's needs.  It is quite possible to run Unix systems with NO
swap if you have sufficient ram.    See
http://aplawrence.com/Boot/swap.html for a more lengthy discussion of
that with examples (it uses a different Unix but the principles apply
to most or probably all modern Unix systems)

Second, for most of us, there's very little or no actual swapping going
on at all: it's paging  that swap gets used for, and much of that is
driven by LRU (least recently used) algorithms, so "fragmentation" is
unimportant.

Third, even if there IS real swapping or large numbers of pages moving
out, fragmentation in the sense it is normally used in the case of a
file system is not generally an issue either because the swap daemon is
free to select contiguous space: it isn't constrained by an existing
file system.


If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

Comments?



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Auto FTP Manager

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

g_face.jpg

This post tagged:

       - MacOSX




Unix/Linux Consultants

Skills Tests

Guest Post Here