Operating system and C++

In summary, the conversation discussed the topic of learning operating systems, specifically in relation to the use of C and C++ in a class at Puget Sound University. The expert recommended isolating a test machine for experimentation and provided resources for introductory learning. The conversation also touched on the importance of understanding operating systems and the potential struggle for students who are not familiar with C and C++. The topic was brought up by the speaker's grandson and the expert suggested that studying operating systems may not necessarily be necessary for general computer knowledge. The conversation ended with the speaker deciding to focus on learning graphics and gaming with C++.
  • #1
yungman
5,718
240
Hi

I want to know a little more about learning operating system. My grandson told me he is taking a class in operating system and the teacher use C and C++ mostly. He and his friends are in trouble because his school is Java based, none of them really know C++ and C.

Is Operating system written in C or C++? What do I have to learn in order to study operating system? Is it useful to learn operating system? I just want to get some information.

thanks
 
Technology news on Phys.org
  • #2
As a field of study, Operating Systems is an advanced set of topics, encompassing a multitude of advanced concepts and techniques. I recommend that you isolate a test machine for your OS experiments, or at least use a separate HDD; OS experimentation on a system that you rely on is foolhardy. A good open source VM (Virtual Machine) product, e.g. VirtualBox, can be very helpful for experimental learning in the OS arena.

I think that it's important to learn some OS generalities before delving into the internals ##-## here are a couple of introductory references:
https://en.wikipedia.org/wiki/Operating_system
https://en.wikipedia.org/wiki/Operating_system_abstraction_layer

If you want to learn internals of some operating system, you'll need to look at source code -- here's a reference that may help you to decide which one to look at first :
https://en.wikipedia.org/wiki/Comparison_of_open-source_operating_systems
 
  • Informative
  • Like
Likes yungman and berkeman
  • #3
You ask this question without hinting at what you want to do with it. Study operating systems if you want to develop or modify operating systems. You can do a lot of work on computers without taking a class on operating systems. On the other hand, if it is general knowledge on computer systems that you are after, studying operating systems would not hurt.
 
  • Like
Likes yungman
  • #4
yungman said:
Is Operating system written in C or C++?
Based on my experience in the Windows Division at MSFT, much of the kernel code is written in C or C++, but some of the user-mode code is written in C#. At the time I was in the Windows Division, I saw a smattering of x86 assembly code in one of the video display drivers. That may or may not still be true.
yungman said:
What do I have to learn in order to study operating system?
The real question is why do you want to learn about operating systems? Modern operating systems are very complex.
If you feel you really need to learn about operating systems, here's a link to a good source - Windows Internals, Part 1: Covering Windows Server 2008 R2 and Windows 7 (Developer Reference) by Mark E. Russinovich, David A. Solomon, Alex Ionescu (2012) Paperback: Mark E. Russinovich: Amazon.com: Books

You can get this as cheaply as about $5 used. The main author, Mark Russinovich, is a very well-known expert on Windows internals. The same is true for another of the authors, Alex Solomon. I attended a several-day class run by Alex Solomon.
 
  • Like
Likes sysprog and yungman
  • #5
Much of the NT achitecture that is present in modern-day Windows editions grew out of the design and implementation of OS/2 ##-## the 1988 classic Inside OS/2, by Gordon Letwin, provides a wealth of insight not only regarding OS/2, but also regarding Operating Systems in general ##-## it's available on Amazon and on other sites, in various conditions at various prices.
 
Last edited:
  • #6
There are different types of operating systems, including Windows, Linux, real-time (RTOS), embedded, etc. Some may be more interesting to you than others. I noticed a Youtube series on RTOS that might easily give an overview with a special emphasis on real-time OS.
 
  • Like
Likes BvU and sysprog
  • #7
Thanks guys for your time, I am wasting your time. You all know how much I know, this sounds to be way over my head.

Why I ask? Just like why I study C++. My grandson said he didn't have any motivation, so I study C++ and nip on his heal for motivation. He is telling me he's in trouble because the class on operating system he is taking is based on C and C++, none of his friends know C and C++. I thought if I learn some operating system, I might be able to help him.

I guess not. I am not going to kill myself for it.

Thanks
 
  • #8
FactChecker said:
Lenux
You probably mean Linux. There's also Unix, out of which came Linux, originally created by Linus Torvalds.
 
  • Like
Likes FactChecker
  • #9
It is strange that he is in a class using C++ and the school "is based on Java". Is this class at the school? What level of school is it? Anyway, it would be good to know what OS, text, references, or notes are being used in the class. When you get into the code, operating systems can be very different from each other.
 
  • #10
FactChecker said:
It is strange that he is in a class using C++ and the school "is based on Java".
The student in question is attending university. Many colleges and universities present their intro CS classes in Java these days, which is of little use in a class on operating systems.
 
  • #11
FactChecker said:
It is strange that he is in a class using C++ and the school "is based on Java". Is this class at the school? What level of school is it? Anyway, it would be good to know what OS, text, references, or notes are being used in the class. When you get into the code, operating systems can be very different from each other.
He is third year in Puget Sound University in Washington. It is more an art school than science. Yes, it's funny they based on Java. I kept telling him C and C++ is important in tech sector and gaming. I did my best to motivate him, but you can only lead them to the water, you cannot drink for them.

I thought since I have been learning C++, I might be able to help him on the syntax. I guess he's on his own, I am not going to kill myself over this.

I guess I am going to stay on course, learning graphics and gaming with C++ from the book by John Horton I bought. This will review my C++ also as I gone through it very fast, I need to review a lot of it. I designed memory map stuffs in hardware, I am familiar enough with memory map for screen. Hopefully it's going to be easier this go around.
 
  • #12
yungman said:
He is third year in Puget Sound University in Washington.
It's University of Puget Sound, commonly referred to as UPS. I have a few credits from that school for a two-semester calculus course I took when I was stationed at Ft. Lewis, back in the late 60s.
yungman said:
It is more an art school than science.
I don't believe that is true. For sure it's not Stanford or MIT, but as a university, it has curricula in all sorts of areas.
 
  • #13
Mark44 said:
The student in question is attending university. Many colleges and universities present their intro CS classes in Java these days, which is of little use in a class on operating systems.
That makes sense. Saying that the entire school was based on Java sounded more like high school than a college. But introductory classes at universities often select a language suited for introductory learning.
 
  • #14
Mark44 said:
It's University of Puget Sound, commonly referred to as UPS. I have a few credits from that school for a two-semester calculus course I took when I was stationed at Ft. Lewis, back in the late 60s.
I don't believe that is true. For sure it's not Stanford or MIT, but as a university, it has curricula in all sorts of areas.
That's what he told me. I visited there, science dept is very small.
 
  • #15
  • #16
Try to get hold of "Operating Systems - Design and Implementation" by Andrew S. Tanenbaum. He walks you through the design and implementation of a small OS (Minix - which impressed Linus Torvalds so much that he wrote a larger version - Linux).
 
  • Like
Likes BvU
  • #17
Most operating systems for X86 (like Windows NT), or ARM (embedded) are mostly C with some assembly. Later versions of Windows may have some C++ or C# as mentioned, but that isn't common. The features that C++ or C# add to C are rarely used in the internals of an operating system, and probably mostly used for user interface or user programs included with Windows. I did some device drivers for Windows NT and Xenix (an early version of Unix for PC), which were mostly C and some assembly. I don't recall any device drivers at that time that included any C++ code.

As an example, for the internals of an operating system, there are buffer pools and message pools (for inter-thread communication), and little or no memory allocation, and no garbage collection.
 
Last edited:
  • Like
Likes BvU
  • #18
rcgldr said:
I don't recall any device drivers at that time that included any C++ code.
Neither do I. Device drivers and other hardware-near software cannot afford linking to libraries that may or may not depend on the operating system being finished.

BTW - you can read more about Minix here: https://en.wikipedia.org/wiki/Minix .
 
  • #19
Svein said:
Try to get hold of "Operating Systems - Design and Implementation" by Andrew S. Tanenbaum. He walks you through the design and implementation of a small OS (Minix - which impressed Linus Torvalds so much that he wrote a larger version - Linux).
I find it impressive and instructive to browse this and see the mind-bogglingly rapid developments when comparing 3rd ed (2006, Minix) with "Modern Operating Systems" - Andrew Tanenbaum, 2nd ed (2001, Unix, W2000) -- 3rd ed (2009, Linux, WVista) -- 4th ed with Herbert Bos (2015, Unix, Linux, Android, W8). And W8 has as whiff of ancient history already !

We sure live in interesting times !

##\ ##
 
  • #20
Was SCO (Santa Cruz Operations) Xenix (late 1980's) based on a prior system or "scratch built"? I wrote a couple of device drivers for tape drives (I worked at a tape drive company at the time) and had to go on-site to do most of the development. My device drivers used nested pointer to functions as a way to implement interrupt driven nested state machines, which SCO adapted for other drivers there.
 
  • #21
rcgldr said:
Was SCO (Santa Cruz Operations) Xenix (late 1980's) based on a prior system or "scratch built"? I wrote a couple of device drivers for tape drives (I worked at a tape drive company at the time) and had to go on-site to do most of the development. My device drivers used nested pointer to functions as a way to implement interrupt driven nested state machines, which SCO adapted for other drivers there.

Good question.
https://en.wikipedia.org/wiki/SCO–Linux_disputes

"Through this chain of sales, SCO claims to be the "owner of UNIX". The validity of these claims is hotly contested by others."

http://www.groklaw.net/article.php?story=20031222174158852
Linus' First Analysis of the Files
 
  • #22
rcgldr said:
Was SCO (Santa Cruz Operations) Xenix (late 1980's) based on a prior system or "scratch built"

Mix of their PDP unix plus AT&T source, possibly via Microsoft.

While I don't expect people writing device drivers or time-critical code would do so in C++, the story is different for utilities. No reason cron, for example, couldn't be in C++. (It's in C)
 
  • #23
Before delving into any code for an operating system, do you really have a good grasp of what-all an operating system IS? A starter lesson is here: https://en.citizendium.org/wiki/Operating_system

Yes, most personal computer OS's today are written mainly in C and C++. That code is tied fairly closely to the hardware and computer architecture underneath the OS.

There is, in my opinion, a very good reason to be interested in OS's, and that is performance. Operating systems could reasonably be considered to include, also, compilers and layers of virtual machines that underpin programming languages such as Java. It is a huge topic.

I once spent an entire weekend reading the C linking and loader manual, about how it loads a C program before the program can run and links it with both static and dynamic C libraries. That was a very useful exercise and cleared up a whole host of issues for me. Yungman, as someone who is used to program close to the metal, looking at the Linux linking/loader manual is possibly a good thing to look into.

But the real reason to learn such things is performance, and if you are doing, say, game programming, performance matters. It can also matter a lot in some kinds of programming and web dev. If concerned about performance (if that is a requirement for a program from the start), then it is impossible, in my opinion, to know too much about operating systems, computer architecture, and how programs and linked and loaded (and unloaded). Including those very dense topics of caching and memory management at processor level.

SOMEBODY needs to be learning these things. The generation of programmers who wrote the bulk of the operating systems we are currently using are actually getting old, or have even died off!
 

1. What is an operating system?

An operating system (OS) is a software program that manages a computer's hardware and provides common services for computer programs. It acts as an intermediary between the hardware and the software, allowing different programs and applications to run smoothly on the computer.

2. What is the role of an operating system?

The main role of an operating system is to manage the computer's resources, including the processor, memory, and storage, and provide a user-friendly interface for users to interact with the computer. It also handles tasks such as managing files, controlling input and output devices, and ensuring the security of the system.

3. What is C++?

C++ is a powerful, high-level programming language that was developed as an extension of the C programming language. It is widely used for building operating systems, system software, device drivers, and other low-level programs that require direct access to hardware resources.

4. How is C++ used in operating systems?

C++ is commonly used in operating systems because it allows for efficient and direct access to hardware resources, making it ideal for creating system-level programs. It also offers features such as portability, multi-threading, and memory management, which are essential for building complex operating systems.

5. What are the advantages of using C++ in operating systems?

One of the main advantages of using C++ in operating systems is its efficiency and speed. Since C++ allows for direct access to hardware resources, it can perform tasks quickly and efficiently. Additionally, C++ is a portable language, meaning the code can be easily transferred and run on different platforms. It also supports multi-threading, allowing for better performance and utilization of the computer's resources.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
6
Views
995
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
23
Views
2K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
Replies
4
Views
995
  • Programming and Computer Science
Replies
8
Views
831
  • Programming and Computer Science
Replies
31
Views
2K
Back
Top