Don't Get Hit (Tyler Green) Mac OS

Posted on  by
  1. Don't Get Hit (tyler Green) Mac Os Catalina
  2. Don't Get Hit (tyler Green) Mac Os 8

Memory usage

If you're reading this article for tips on how to improve your Mac OS X experience, now's the time to pay attention. Aside from purchasing a new Mac, the most important thing you can do to make Mac OS X more bearable is to buy more RAM. Go ahead, don't be shy. 512MB sticks are going for as little as $50 if you look hard enough.

Frequent readers may recall that both the G3/400 and the dual G4/450 had only 256MB RAM at the time of the 10.0 review. After using 10.0.x for a few weeks on the G4, I got sick of hearing my disk grinding constantly and upgraded to 512MB. The silence that followed was truly golden. It was a bigger improvement than any of the 10.0.x upgrades, by far.

  1. Operating system/browser. Windows Media Player 12 Learn more. Included in clean installs of Windows 10 as well as upgrades to Windows 10 from Windows 8.1 or Windows 7. In some editions of Windows 10, it's included as an optional feature that you can enable.
  2. Casio launches its first G-Shock smartwatch with Wear OS, available in May for $700 — Big focus on sports tracking and 200m water resistance — Casio has launched its first G-Shock smartwatch with Wear OS - the G-Squad Pro GSW-H1000 - aimed at sports and outdoors fanatics.
  3. Download macOS Catalina for an all‑new entertainment experience. Your music, TV shows, movies, podcasts, and audiobooks will transfer automatically to the Apple Music, Apple TV, Apple Podcasts, and Apple Books apps where you’ll still have access to your favorite iTunes features, including purchases, rentals, and imports.
  4. For GUI users, you can take a trip to Apple About This Mac and click the System Report button. Scroll down the sidebar to “Legacy Apps” and click on it. Here you’ll see a list of all the apps that won’t run on Catalina. MacOS 10.15 itself will also list any legacy apps.

(Although the G3/400 primarily runs Mac OS 9, I upgraded it to 384MB because, well, RAM was too damn cheap not to, I guess.)

Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, and expert device support.

After a few weeks at 512MB, the G4 started to get a little grind-happy again. I shuffled some RAM between machines to boost the G4 again to its current total of 768MB, and noticed a nearly linear boost in 'smoothness' in daily use.

What's going on here? Where is all this memory going? Is Mac OS X a black hole for RAM? In a word, yes. But that's actually a good thing...sort of. I talked about Mac OS X's virtual memory system as it relates to the user experience and the infamous 'minimum required system' in the 10.0 article. I'd like to take a short break from the 'review' portion of this article and go into more detail about Mac OS X's memory system (as requested by numerous readers). Feel free to skip ahead to the summary if you're only interested in the RAM usage performance of 10.1 relative to 10.0.x.

(Note: A lot of the information presented below is heavily simplified in an effort to reach as broad an audience as possible. If you're interested in the gory details, picking up a good book on the topic is your best bet.)

Virtual Memory Basics

Mac OS X manages memory very differently than classic Mac OS. The first key to understanding memory usage in Mac OS X is to be understand how a modern virtual memory system works.

In a virtual memory management system, there is a distinction between real, physical memory and 'virtual' memory. An application's virtual memory size is the amount of memory the application thinks it has allocated, but only a (possibly very small) portion of that memory may actually be stored in the real, physical RAM chips sticking out of your computer's motherboard at any given time. The rest exists on disk in some form, usually in one or more 'swap files.'

The operating system decides what portion of which processes exist in physical memory at any given time. This decision process is complex, and varies from OS to OS, but it usually uses recent usage statistics in its decision making process. A process that has not accessed a particular piece of (real, physical) memory for a long time may find that memory written out to disk so that another more active process can use that piece of physical memory. When a process has a large portion of its memory removed from physical RAM and placed on the disk, it is said to be 'swapped out.'

If a process needs a previously swapped-out piece of memory again, it will be transferred from disk back into physical memory—possibly in a different location than its earlier home in physical memory. When a previously swapped-out application becomes active again and causes a large portion of its memory to move from disk back to physical memory, it is said to be 'swapped in.'

To simplify memory management, the operating system deals with memory in uniform units of a minimum size (usually 4K) called 'pages.' Swapping out a page is also called a 'pageout', and swapping in a page is called a 'pagein.' The policy used by the operating system to control memory management is often called the 'paging algorithm.'

Memory pages may store almost anything: code, data, even pieces of files. In fact, one of the useful features of virtual memory is that entire files may be 'memory mapped': a file on disk may be accessed as if it's a series of memory pages that have been swapped out to disk.

Further optimization is possible by allowing processes that need access to the same information (code, data, files) to share memory pages. Only when one of the processes sharing a particular memory page chooses to modify that page is a private copy created. This behavior is aptly named 'copy-on-write', and it allows many processes to efficiently share memory, with only the 'differences' allocated separately.

Not all memory may be swapped out. Some pages are 'wired down', meaning they may never leave physical memory during their lifetime. The memory pages that contain the operating system code that control the paging algorithm can never be swapped out, for instance (think about it). In fact, much of the operating system kernel is usually wired down.

Each active process needs some minimum portion of its memory pages to exist in physical memory in order to function efficiently. This portion is called the 'working set.' When the working set of all the active processes cannot fit in physical memory, the operating system must constantly shuttle pages to and from physical memory and the disk in a sort of game of musical chairs gone terribly wrong. A computer in this state is said to be 'thrashing.' The only cure is to either decrease the number active processes or buy more RAM.

The Buffer Cache

The second most important factor in Mac OS X's memory usage behavior is the buffer cache. The buffer cache is meant to speed up access to files on disk. Every time a piece of data is read from the disk, it may (optionally) be stored in memory. If that same piece of data is needed again in the near future, it may still be available in (physical) memory, saving a trip to the disk. Mac OS X implements a 'unified buffer cache', meaning that the buffer cache and the virtual memory system are combined. A page is a page is a page in Mac OS X.

Advertisement

The buffer cache affects RAM usage in ways that a Mac user may not expect. Heavy file i/o can use a lot of physical memory very quickly, potentially thinning out the physical memory presence of running applications. Poorly written applications may exacerbate this problem by using cached file i/o when it is not necessary, or even useful. An application that reads and parses a large file a single time during start-up should probably not use caching i/o, since it is not likely that the application will need those memory pages again some time in the near future before they're evicted from physical memory by another active process.

The Window Server

The final major player in the Mac OS X memory ballet is, perhaps surprisingly, the window server. The window server orchestrates access to the screen, including both low-level drawing and higher-level concepts like the movement and layering of windows.

As discussed in earlier articles, the Quartz display layer (of which the window server is an important part) models the screen as a layered compositing engine much like the layers in a graphics application like Photoshop. Each pixel has a red, green, and blue components, plus a so-called 'alpha channel' which determines its transparency, from totally opaque to totally invisible. The appearance of each pixel on the screen is determined by the composite of all the applications that have a pixel in that position. The window server calculates the composite of those pixels based on the layering and visibility of the participating pixels.

This provides the infrastructure for many of the 'pretty' effects in Mac OS X: the transparent drop-shadows on the windows, the translucent menus and title bars, etc. Each individual application only needs to worry about its own pixels, without regard for anything in front of or behind it. The window server then composites those pixels and draws the result to the screen. This makes application development simpler, leaving the 'hard work' of creating those nice on-screen effects to the operating system rather than each application.

Things get tricky again something on the screen has to move or change color (or transparency). The window server must re-composite every pixel changed by an application before the change can become visible to the user. And the compositing calculation needs not only the value of the changed pixel, but also the values of all other pixels that contribute to that position.

Think about the calculations necessary to do something as simply as move a window in Mac OS X. Every pixel of that window must be re-composited with every pixel of every application in each location for each new position of the window. Imagine a 500x300 pixel window (about 24 rows of 80 column text) moved 100 pixels to the right, with 5 other application windows behind it. That's about 15 million compositing calculations, each with 30 operands (red, green, blue, and alpha values for each contributing pixel from each application), all for moving a small window a few inches.

But wait, there's more. When something changes on the screen (a window moves, appears, or disappears), pixels belonging to other applications are revealed. Those pixels must, of course, be composited before they can be displayed, and those compositing calculations need all the pixel values for each application that has a pixel in the newly revealed area. Adding the compositing calculations associated with the newly revealed screen area in the moving window example above (and accounting for the transparent drop-shadow on the window) brings the grand total to almost 17 million 20-30 operand calculations!

Hit

Of course, this is a worst-case scenario that would only happen in a very naive implementation. Many optimization are possible. Solid pixels can abbreviate the number and difficulty of the compositing calculations tremendously, especially if the front-most pixel is solid.

But there's no getting around the fact that the window server still needs access to all the pixels of all the windows on the screen at all times, since it never knows when one of them will be required in a compositing calculation. Furthermore, this access needs to be very fast, since no one wants to wait while the OS reads pixels from a slow medium like disk.

Mac OS X provides the window server with fast access to pixels by making all windows 'buffered.' All the pixels of a buffered window are stored in in memory. When one of those pixels is needed in a compositing calculation, the window server simply reads the memory location corresponding to that pixel. It does not have to 'ask' the application for the pixel. In fact, an application may be entirely frozen and unresponsive, but its window can still be moved around, hidden, and revealed without any participation from the application. When an application wants to change its window, the changes are all sent through the window server, which updates the window's buffer to reflect the changes.

This is a big change from classic Mac OS, where each application drew directly to the screen, and any newly revealed portion of a window had to be re-drawn by the application that owned that window. Window buffering and compositing had to be implemented explicitly by each application that wanted it, and it was totally independent of any other running applications.

From a development perspective, buffered windows make applications easier to code. Drawing only has to be done once, after which portions of the window may be hidden and revealed without triggering any custom redraw code in the application. From a user's perspective, window buffering allows newly revealed windows to 'just be there,' with no visible redraw. Buffering also provides smooth, flicker-free window movement. Mac OS X even goes so far as to synchronize screen drawing with the sweep of the electron beam on CRTs to avoid flicker and 'tearing.'

Quartz's buffering is generally a good thing. It improves the visual quality of on-screen elements and it makes application development easier. But what does all of this have to do with memory usage?

Advertisement

We've already seen the potentially tremendous number of calculations required to composite items on the screen. These calculations are all done by the CPU in Mac OS X, and are not off-loaded to a video card's GPU. But surprisingly, this is not as large a CPU hit as you might expect, thanks to both the common case of totally opaque pixels and the speed of today's CPUs (yes, even on Macs). A few million calculations every once in a while may cause a some instantaneous load on the CPU, but it is not really a factor in the long term. That said, it would be great to have the video card do these calculations rather than the CPU—something I'm sure Apple is working on. In pathological cases (e.g. the famous shaking transparent terminal window) the CPU load can briefly become significant.

But it's the memory usage that's the real killer. Classic Mac OS applications only need to retain the essential information about each window: its size, features, and contents. Mac OS X applications have to retain the same information, of course, but remember that the window server also has to retain a complete memory image of every pixel in the window! Repeat this for every single window on the screen, and it adds up very quickly.

Classic Mac OS requires only a few kilobytes to store the basic structures that define a simple, empty window. In Mac OS X, the total memory required for even a completely empty window is proportional to its size, regardless of the nature of its contents (if any).

In my daily work as a web programmer, this difference is very apparent. The nature of the work requires many windows to be open at once: text editors, web browsers, terminals, etc. In classic Mac OS, each text editor window, for example, would require only a small amount of memory for the window itself, plus whatever backing store the editor keeps for the (ASCII) text in each window. In Mac OS X, each simple text editor window becomes a giant 32-bit image (in addition to the other information, of course). Multiply this phenomenon across all the other applications, each with many windows of their own, and you quickly run into trouble.

Take a look at this window list from a typical work day on my G4. The total memory used by window buffers alone is an astounding 120MB! And remember, this is before even accounting for things like, say, the memory required by the actual applications and the core OS itself!

(The possibility of decreasing the window server's memory usage—and, more importantly, decreasing memory bandwidth usage—by compressing inactive window buffers is intriguing, but this feature is not officially supported in 10.1.)

The window server uses the same virtual memory system as every other part of OS X, of course. That means that the memory that makes up each window buffer is eligible to be paged out just like any other piece of memory. This is where the real performance hit comes in. Attempting to manipulate a window that has had some or all of its window buffer pages swapped out is a painful, stuttering, disk grinding experience as the virtual memory system rapidly tries to bring those pages back into physical memory from disk (evicting other resident pages while doing so, of course).

I encounter this phenomenon on a grand scale every time I return to work on Monday, after a weekend spent connected to the G4 via the command line running non-GUI applications from the terminal. On those Monday mornings, almost every window buffer is likely to have been swapped out during the weekend. The disk grinding session that ensues when all the windows are paged back in as I start to use them again is quite spectacular.

And remember, this is a system with 768MB of RAM. But the OS doesn't care. My command line work over the weekend required significant memory (compiling, running web servers, etc.), and the OS provided it. None of the GUI applications were active over the weekend, so their pages were swapped out to disk to make way for the memory needs of the command line activity. This is to be construed as a feature.

So, buffered windows: friend or foe? In the end, they are a friend. The OS X window server provides a higher level of abstraction to applications. With more abstraction comes more resource usage. But 'increased abstraction' is essentially the definition of progress in the computer industry (otherwise we'd all still be programming in machine language). But like much of the rest of OS X, pervasive window buffering is slightly ahead of current state of hardware. Long-term, this is also a good thing, in my opinion. It's easier to wait for hardware to catch up to your ambitious (but clean) software architecture than it is to try to revamp your operating system in response to advances in hardware (just ask Apple ;-)

Swap File Optimizations

Since it is possible to use up almost any amount of physical RAM in OS X (I fill 768MB very quickly), further performance gains are still possible by moving the swap file(s) to a separate disk. No matter how much RAM you have, you will almost certainly hit the swap file eventually. The disk heads on the drive containing the OS and applications will already be scurrying around as they read and write application and OS code and data files. Making the swap file another stop on their frantic journey just adds yet another voice to the cacophony of disk grinding. Swap file access is especially painful since is usually interleaved with other disk operations: read a piece of application code from disk into memory, write an old memory page out to the swap file, read a piece of a data file into the buffer cache, write an old memory page out to the swap file, read a piece of application code from disk into memory...etc. etc. (Can you hear the grinding? :-)

Don't Get Hit (tyler Green) Mac Os Catalina

Putting the swap file on a disk mechanism of its own allows the heads on that disk drive to benefit from better locality of reference (i.e. they don't have to move around as much), and frees the application and OS drive to concentrate on its tasks. There is no Apple-sanctioned way to move the swap file to another drive, and certainly no GUI for it. But brave users can follow the directions available on the web. Just be sure to make a total backup first, because you can potentially hose your entire system if you're not careful.

I only have one disk at work, but at home I've moved my swap file from the 12GB 5,400 RPM drive that houses OS X and all its applications to my 45GB 7,200 RPM Mac OS 9 drive. The reduction in disk grinding has been substantial.

Simply moving the swap file to dedicated partition on the same disk is of much smaller benefit (if any). The disk heads still need to make many trips to and from the swap partition and the rest of the disk. And since Mac OS X uses individual swap files (rather than a dedicated swap file system), a separate swap partition is only likely to make a significant difference if the previous swap files were heavily fragmented on disk. (Note: I'm talking about 'external' fragmentation, where pieces of each swap file are spread all over the disk. The swap files themselves are always heavily 'internally' fragmented, meaning difference pieces of memory are spread sparsely within each swap file.)

© Provided by Business Insider Mac computers offer several ways to address your missing or disappearing Dock issue. MacFormat Magazine/Getty Images
  • You can fix a disappearing Dock on a Mac computer through a few troubleshooting methods.
  • Your Mac Dock keeps a selection of commonly used apps along the bottom edge of your screen for quick access.
  • While the Dock is usually visible on the screen, it can disappear with no clear way to get it back.
  • Your Mac's Dock doesn't show up in full screen mode, and it can be set to disappear automatically, so troubleshoot these issues first.
  • Visit Business Insider's Tech Reference library for more stories.

The Mac Dock comes pre-loaded with some of your system's most-used applications. You can also customize which applications are included in the Dock.

Sometimes that Dock can disappear, making navigating your Mac more tedious. The upgrade to Mac's Catalina OS, for example, has seen users complain that their settings are automatically changed, so the Dock disappears by default.

If you're in full screen mode, it's important to note the Dock will not show up. To do so, disable fullscreen mode by hitting the 'Esc' key and hitting the green button in the top left corner.

You can also check whether your Dock is set to hide automatically by moving your cursor over the bottom edge of your screen and seeing if it reappears.

If neither of these things is the reason, sometimes adjusting your settings can often make your Dock reappear. Here's how to get your Dock back.

How to fix a disappearing Dock on a Mac in System Preferences

1. Click the Apple logo in your Mac's upper left corner.

2. Scroll down to 'System Preferences.'

© Ryan Ariano/Business Insider This is the second option in the dropdown menu. Ryan Ariano/Business Insider

3. Select 'Dock.'

© Ryan Ariano/Business Insider The logo will appear mostly black with what looks to be little apps along the icon's bottom. Ryan Ariano/Business Insider

4. If 'Automatically hide and show the Dock' is checked, uncheck the box next to it.

© Ryan Ariano/Business Insider You can also choose to show open applications, animate Dock icon when you click them, and more. Ryan Ariano/Business Insider

How to fix a disappearing Dock on a Mac by restarting the Dock

1. Click on your desktop screen until you see the 'Finder' menu appear in the top left corner.

© Ryan Ariano/Business Insider It should appear in the top left next to the Apple icon. Ryan Ariano/Business Insider

2. Click on 'File.'

3. Select 'New Finder Window.'

Don

4. Select the 'Utilities' icon.

© Ryan Ariano/Business Insider Utilities will be represented by a blue folder. Ryan Ariano/Business Insider

5. Launch the Terminal.

6. Paste or write 'killall Dock' into the Terminal window to turn off the Dock and automatically restart it.

© Ryan Ariano/Business Insider A solid black box with white lettered coding should appear. Ryan Ariano/Business Insider

How to fix a disappearing Dock on a Mac by resetting the Preferences list

1. Click on your desktop until you see the Finder toolbar.

2. Select 'Go.'

© Ryan Ariano/Business Insider This option will be between 'View' and 'Window.' Ryan Ariano/Business Insider

3. Scroll down to and choose 'Go to folder.'

Don't Get Hit (tyler Green) Mac Os 8

© Ryan Ariano/Business Insider A window will appear when you click this link. Ryan Ariano/Business Insider

4. Type '~/Library' into the search bar that appears and hit enter.

5. Click on the 'Preferences' folder.

© Ryan Ariano/Business Insider You'll need to scroll towards the bottom to find this folder. Ryan Ariano/Business Insider

6. Type 'com.apple.dock.plist' into the Preferences window search bar.

7. When you find the file, drag it into the trash.

8. Restart your computer.

Related coverage from Tech Reference: