Posted: . At: 10:00 AM. This was 8 months ago. Post ID: 18394
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Another look at the NeXTSTEP source code.


I’m sorry, but there seems to be a misunderstanding. NeXTSTEP did not use a Linux-based kernel architecture. NeXTSTEP was the operating system developed by NeXT Computer Inc. in the late 1980s and early 1990s, which eventually became the foundation for macOS. It had its own unique architecture and was not based on the Linux kernel.

NeXTSTEP was created by Steve Jobs’ NeXT Computer Inc. after his departure from Apple in the mid-1980s. It was designed to be a highly advanced and innovative operating system, with a focus on object-oriented programming, advanced graphical user interfaces, and high-performance capabilities.

In terms of its technical architecture, NeXTSTEP utilized a microkernel-based design. A microkernel is a minimalistic kernel that provides only essential operating system services, while other functions are implemented as separate user-space processes or servers. This architecture allows for greater modularity and flexibility in the operating system design, making it easier to add new features and maintain the system.

The core of NeXTSTEP’s microkernel was based on the Mach microkernel developed at Carnegie Mellon University. Mach provided the basic mechanisms for inter-process communication, memory management, and hardware abstraction. NeXTSTEP built upon this foundation to create a complete operating system environment that included features like the Display PostScript system for advanced graphics rendering and the Objective-C programming language for object-oriented development.

One of the defining features of NeXTSTEP was its innovative graphical user interface (GUI). It introduced the concept of the “Workspace Manager,” which allowed users to organize their workspaces, applications, and documents in a spatial and visually intuitive manner. The GUI also included features like a sophisticated window management system, advanced typography using Adobe’s PostScript fonts, and support for rich media.

NeXTSTEP was not related to the Linux kernel architecture. Linux, on the other hand, is a Unix-like operating system kernel that was created by Linus Torvalds in the early 1990s. It was developed as an open-source project, and over time, various distributions (such as Ubuntu, Fedora, and Debian) were built on top of the Linux kernel, creating complete operating systems. Linux became popular due to its open nature, modularity, and availability on a wide range of hardware platforms.

While both NeXTSTEP and Linux aimed to provide powerful and feature-rich operating systems, they followed different technical paths. NeXTSTEP was known for its object-oriented design, advanced GUI, and microkernel architecture, while Linux gained popularity through its open-source nature and the ability to run on a variety of hardware. NeXTSTEP eventually evolved into macOS after Apple acquired NeXT Computer Inc. in 1997, bringing with it many of the innovative concepts and technologies that were present in NeXTSTEP.

Below is some sample code.

next-src/next/NeXTDimension/NextDimension-21/cmds/run680.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <mach.h>
#include <servers/netname.h>
#include <stdio.h>
#include "ND/NDlib.h"
 
main( argc, argv )
    int argc;
    char **argv;
{
    extern struct mach_header _mh_execute_header;
    port_t ND_port;
    port_t debug_port = PORT_NULL;
    char * program = argv[0];
    char *prog860 = "a.out";
    int slot = -1;
    int slotbits, i;
    kern_return_t r;
 
    while ( --argc )
    {
    	if ( **(++argv) == '-' )
	{
		if ( strcmp( *argv, "-s" ) == 0 && argc > 1)
		{
		    --argc;
		    slot = atoi( *(++argv) );
		}
		else
		    usage( program );
	}
	else
	    prog860 = *argv;
    }
    r = netname_look_up(name_server_port, "", "NextDimension", &ND_port);
    if (r != KERN_SUCCESS)
    {
    	mach_error( "netname_lookup", r );
	exit( 1 );
    }
 
    r = ND_GetBoardList( ND_port, &slotbits );
    if (r != KERN_SUCCESS)
    {
    	mach_error( "ND_GetBoardList", r );
	exit( 1 );
    }
    if ( slot == -1 )
    {
    	for ( i = 0; i < SLOTCOUNT*2; i += 2 )
	{
	    if ( ((1 << i) & slotbits) != 0 )
	    {
	    	slot = i;
		break;
	    }
	}
	if ( slot == -1 )
	{
	    printf( "No NextDimension board found.\n" );
	    exit( 1 );
	}
    }
    else
    {
    	if ( ((1 << slot) & slotbits) == 0 )
	{
	    printf( "No NextDimension board in Slot %d.\n", slot );
	    exit( 1 );
	}
    }
    /*
     * Run860 supports debugging, bind860 doesn't...
     * This keeps demo hackers happy.
     */
#if defined(DEBUG860) || defined(RUN860)
    /* Allocate a debug port to handle console I/O for the ND board. */
    if ( (r = port_allocate( task_self(), &debug_port)) != KERN_SUCCESS)
    {
    	mach_error( "port_allocate", r );
	exit( 1 );
    }
    /* Conect the debug port to the ND device driver. */
    if ( (r = ND_SetDebug( ND_port, slot, debug_port)) != KERN_SUCCESS)
    {
    	mach_error( "ND_SetDebug", r );
	exit( 1 );
    }
#endif
#if defined(BIND860)
    r = ND_BootKernelFromSect(ND_port, slot, &_mh_execute_header, "__I860", "__i860");
    if ( r != KERN_SUCCESS )
    {
    	mach_error( "ND_BootKernelFromSect", r );
	exit( 1 );
    }
#endif
#if defined(RUN860)
    r = ND_BootKernel( ND_port, slot, prog860 );
    if ( r != KERN_SUCCESS )
    {
    	mach_error( "ND_BootKernel", r );
	exit( 1 );
    }
    fprintf( stderr, "Launching %s (slot %d)\n", prog860, slot );
#endif
#if defined(DEBUG860)
    printf( "Monitoring NextDimension board in Slot %d.\n", slot );
#endif
#if defined(DEBUG860) || defined(RUN860)
    ND_DefaultServer( ND_port, debug_port );
#endif
#if defined(BIND860)
    WaitForParent();
#endif
    ND_Close( ND_port, slot );
    exit( 0 );
}
 
#if defined(BIND860)
WaitForParent()
{
	int ppid;
 
	ppid = getppid();
	/* 
	 * Sleep, checking at intervals to see if the parent has gone
	 * away.  This is a crock.
	 */
	do
	{
		sleep( 5 );
	}
	while ( kill( ppid, 0 ) == 0 );
}
#endif
 
 
usage( char * program )
{
#if defined(RUN860)
	printf( "Usage: %s [-s Slot] [i860 program]\n", program );
#else
	printf( "Usage: %s [-s Slot]\n", program );
#endif
	exit( 1 );
}

This is a very clean and interesting source code example.

Download the source code dump here: https://mega.nz/file/g44UVBLa#A8Q4PIsCNV-Gsp33qCZ_oTLR_3GEOOdmIiDZ1hTqG4s. 26 megabytes compressed.

Another example is in the same folder.

next-src/next/NeXTDimension/NextDimension-21/cmds/bind860.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#
#	This is a simple hack to link 860 objects for our standalone environment
#	and bind them with a host launcher.
#
BIN=/Net/k9/dps/nd_proj/bin
LIB=/Net/k9/dps/nd_proj/i860/lib
CC=$BIN/cc860
LD=$BIN/ld860
MUNGE=$BIN/unixsyms
BINDOBJ=$LIB/bind860.o
CRT0=$LIB/crt0.o
LIB1=$LIB/libsa.a
LIB2=$LIB/gcc-runtime860
 
outfile="a.out"
args=""
 
while [ $# != 0 ]; do
	case $1 in
	-o)
		shift
		outfile=$1 ;;
	-debug)
		LIB1=$LIB/libsa_debug.a ;;
	*)
		args="$args $1" ;;
	esac
	shift
done
 
$LD -p -T f8000000 -o /tmp/bind860.$$ -e pstart $CRT0 $args $LIB1 $LIB2
$MUNGE /tmp/bind860.$$
strip /tmp/bind860.$$
cc -o $outfile $BINDOBJ -segcreate __I860 __i860 /tmp/bind860.$$  -lNeXT_s -lsys_s
/bin/rm -f /tmp/bind860.$$

And here is a Makefile.

#
# This Makefile handles installing all stuff in the build_files project.
#
# (c) NeXT, Inc. 1988
#
 
LIBDIR=	$(DSTROOT)/usr/local/lib
SRCROOT=$(DSTROOT)/src/build_files
MAKEFILE_DIR = $(LIBDIR)/Makefiles
ALLDIRS = $(LIBDIR) $(MAKEFILE_DIR)
 
MAKEFILE_FILES = Makefile.lib.user Makefile.lib Makefile.app \
		Makefile.app.user Makefile.common Makeinc.common
 
install: $(ALLDIRS)
	cd $(MAKEFILE_DIR); /bin/rm -f $(MAKEFILE_FILES)
	install -q -m 444 $(MAKEFILE_FILES) $(MAKEFILE_DIR)
 
clean:
 
# install the source
installsrc:
	-/bin/rm -rf $(SRCROOT)
	mkdirs $(SRCROOT)
	for f in $(MAKEFILE_FILES) Makefile;		\
		do (cp $$f $(SRCROOT); chmod 444 $(SRCROOT)/$$f)	\
	done
 
$(ALLDIRS):
	mkdirs $@
 
diff:
	for f in $(MAKEFILE_FILES);					\
	    do (echo $$f;						\
	    csh -f -c "diff -c $(MAKEFILE_DIR)/$$f $$f; exit 0")	\
	done

The developers of the classic PC game Doom also used a NeXSTEP computer to run a Doom map editor to make the levels. Read more about this here: https://doomwiki.org/wiki/NEXTSTEP. The PC game Quake was also developed on NeXTSTEP hardware. I am not sure how to build the NeXTSTEP dump, you would need a build environment to compile the code and I do not have that, but I have the source code dump, it was on my old Ubuntu drive and I managed to find the file. I should have uploaded it before, but now I have.

Here is some source code information. That is quite a lot of C code.

(jcartwright@localhost) 192.168.1.5 next  $ cloc --exclude-lang=DTD,Lua,make,Python .
   12696 text files.
    8544 unique files.                                          
    5484 files ignored.
 
github.com/AlDanial/cloc v 1.99  T=7.00 s (1113.9 files/s, 351687.6 lines/s)
---------------------------------------------------------------------------------------
Language                             files          blank        comment           code
---------------------------------------------------------------------------------------
C                                     4109         189391         277860        1297455
Objective-C                            467          22599          22074         133310
C/C++ Header                          2118          39827          83074         125328
Lisp                                   158           5870           6658          43579
Markdown                                16           3757              0          33319
Assembly                               456           4148          20535          30566
yacc                                    31           3850           3082          30311
TeX                                     16           3771           1020          19567
Mathematica                              1           1006              0           6651
Bourne Shell                            93            734           1319           6302
C Shell                                 54            492            649           5031
Pascal                                   3           3612              0           4383
m4                                     101            491              5           3659
lex                                     17            361            256           3591
Windows Module Definition               10            628              0           2905
Logos                                   18            463             18           2428
Windows Message File                    43            468              0           1979
Specman e                                2              0            314           1926
Text                                    10            970              0           1733
D                                        7              2              0           1144
Nemerle                                  6              1              0            829
Prolog                                   9             24             86            638
awk                                      8             66            128            522
C++                                      1           1976              0            401
SWIG                                     2            257              0            315
OCaml                                    1             17              0            215
Perl                                     2             34             63            198
ASP.NET                                  2             29              0            161
Protocol Buffers                         4             37             41            159
diff                                     5             26            147            138
Clojure                                  1             10              7            123
sed                                      9              9             25            121
R                                        1              0              0            112
Gencat NLS                               1            129              0             78
C#                                       4             26             53             72
INI                                      3              0              0             25
Elixir                                   3              0              0             22
MATLAB                                   1              2              0             16
Windows Resource File                    2              0              0              2
IDL                                      1              0              0              1
ProGuard                                 1              0              1              0
---------------------------------------------------------------------------------------
SUM:                                  7797         285083         417415        1759315
---------------------------------------------------------------------------------------

NeXTSTEP computers were used to develop and use the Doom and Quake map editors. This is a screenshot of QuakeEd running on a NeXTSTEP machine and creating a Quake map. Doom ed is also installed on this particular machine. The look and feel of the NeXTSTEP desktop may be obtained on a modern Linux system using the GNUstep framework.


2 thoughts on “Another look at the NeXTSTEP source code.”

  1. I used to administer a nextstep machine (color pizza slab, 24MB ram).

    Wrote display postscript demos and screensavers for it.

    I suspect my melting screen demo is what iD got their melting DOOM screen from.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.