Trying to learn the underpinnings of my favorite operating system.
read moreEssentially, it was created based on NextStep and BSD, which is a Unix derivative. Unix was a very old OS which a bunch of stuff is based on, thus dubbed Unix-like. NextStep itself was Unix-based as well. Again, what we really understand to be the operating system is the kernel, and Mac OS X has the Darwin Kernel, which was developed by Apple and is open source.
iOS is also built on Darwin, so it shares the Unix derivation.
Linux is also Unix-like, but this appears to have just been a design decision and doesn’t actually have direct ties?
Uses virtual memory (so, swap files on disk that processes consider to be “in memory”). Pretty essential so that applications that startup in a physical memory starved system don’t force close (purge from physical memory) other applications. Also uses a buffer cache for files, so a process can request that a file it wrote continue to stay in physical memory for fast secondary use.
WindowServer processes deals with figuring out what needs to be drawn on the screen based on how windows overlap (looking at each window that’s trying to draw at a given pixel, and figuring out what color/transparency should be drawn).
vm_stat.
Should use “top” instead for looking at memory usage. Within top, the pageouts area in the top, the number in parenthesis is the number of pageouts in the last second. A good indicator of whether the computer is slow do to starved physical memory.
use “renice” to change the priority of a running process. 20 is highest, it seems, but running
ps aux -l suggests weird priorities.
Bonjour, or mDNSResponder now probably, is what deals with discovering other devices that speak the language on a network using a variety of predefined broadcast addresses. They do operate with the IP protocol. Should be able to see this traffic with the following wireshark filter: ‘dns and udp.port eq 5353’.
In Unix in general, startup, shutdown, and restart events are handled by shell scripts in /etc/rc.*. Login time events are handled by specific dot files in a user’s home directory, and Mac OS X has a layer on top of Unix for login which has xml based dot files in user’s home directory and startup.
Unix traditionally closes processes by sending a kill signal to a process, waiting a little, and then sending a stronger kill signal. Mac OS X stopped this practice so that you could always force quit an application (they all are under launchd and launched by launchd).
Remember, rwx-rwx-rwx are user, group, everyone. And they’re broken up to three and their binary equivalents are too: 111-000-000 = 7-0-0 or 700. But a file can only have one user and one group.
mdfind is spotlight but on command line; looks like it returns more results.
Journaling file system: will keep a “journal” of pending changes to the file system, so that on power failure or system crash, there’s less of a chance of corruption.
Should read reviews more closely starting at Leopard. http://hypercritical.co/2015/04/15/os-x-reviewed