Is the RT Linux kernel monolithic or a micro-kernel (like QNX)? - linux

I am studying some documents regarding RT linux and qnx and confused about monolithic and microkernel.Some papers are telling that RT linux is monolithic and some are saying that microkernel. I am worried which is right ?? could you please some one answer my question ??
I know QNX is a microkernel Os and confused w.r.t RTlinunx.
Could someone tell me what is the differenec between the two real time operating system and also the below question.
RT linux is monolithic or microkernel ??

IMHO, there is no actual RT Linux1. There are only approaches of adding RT compatibily features² to the official genereal purpose Linux kernel. Examples are RTAI, Xenomai or the PREEMPT_RT patch. Thus, they're all using the same kernel which is definitely a monolithic kernel (and as for Linus this will pretty sure stay this way).
However, a paper³ by Jae Hwan Koh and Byoung Wook Cho about RTAI and Xenomai performance evaluation puts it like this (which indeed sounds more like a separate kernel approach):
RTAI and Xenomai are interfaces for real-time tasks rather than real-time operating systems. Therefore, an OS is needed to use them; Linux is most widely used. In RTAI and Xenomai, the Linux OS kernel is treated as an idle task, and it only executes when there are no real-time tasks to run. The figure below shows the architectures and versions of the real-time embedded Linux used [here]. RTAI and Xenomai are conceptually homogeneous, and they both use a general-purpose Linux kernel and real-time API. However, there is a remarkable contrast.. [in way they handle certain things].
Another picture that if found⁴ supports this point-of-view as well, i.e. having a kernel running on-top of another one as idle task.
1 Having said that, there used to be a OS (kernel) named RTLinux which was working quite similar like the other approaches mentioned in my answer above, ie it runs the entire Linux kernel as a fully preemptive process [1] [2]. RTLinux later merged into the products of Wind River (VxWorks) and did also influenced the work around RTAI. Couldn't find a source about the kernel type.
2 in other words a "real-time extension"
3 "Real-time Performance of Real-time Mechanisms for RTAI and Xenomai in Various Running Conditions", 2013, International Journal of Control and Automation
4 unfortunately I could not determine its source yet.

RT Linux has both linux kernel as well as real time kernel. The real time kernel has higher priority over linux kernel. Please refer following article for details.
http://www.cs.ru.nl/~hooman/DES/RealtimeLinuxBasics.pdf

Related

How is programming in rtems different than Linux?

I am new to programmming in rtem and was wondering how are the two, rtems and linux, are different in terms of programming. I understand rtems is an real time operating system but if you were to make a hello world app, wouldn’t the program be the same?
Note that your question is quite generic. There are a lot of detail differences.
One of the biggest is the format of your binary: Most RTEMS binaries are statically linked together. You only have one big binary containing your system and application. There is some dynamic loading supported but it's not the case used by most users.
As already mentioned my n.m. in the comments RTEMS has a lot of the POSIX API (at least the embedded sub set). So you can use a lot of the same API like you do on Linux.
A big differences is that RTEMS has a global address space (on most targets). So you don't have a separation between tasks. That makes pointer errors a bit harder to debug.
Also a difference: Most embedded systems are targeted for long running applications. In such applications (regardless whether you are on Linux or on RTEMS or on any other system) you should be careful to clean up your stuff (close files, free memory, ...). In Linux (or other desktop class systems) you have processes and the kernel cleans up all resources after your process exits. Although you can create threads in RTEMS no one cleans up after a thread exits.
The POSIX attribute defaults for threads are not specified in the standard and may vary between RTEMS and Linux.

linux 0.01 kernel cross reference

i am searching for a linux cross reference for the first linux kernel 0.01,
many websites provide a LXR (Linux Cross Reference) for existing kernels starting from 2.x but not including old ones.
There is no cross-reference readily available for this version, because it is too old. If you want one, you will have to create it yourself. (Which should not be difficult; this version of the kernel is barely 10k lines of code. This is small enough that a cross-reference is hardly even necessary.)
Keep in mind that Linux 0.01 was a very early release. It represents the original "pre-alpha" version of the kernel that Linus Torvalds made available on his university's FTP server in 1991. At that point in time, the kernel had one developer (Linus himself) and no users.
Moreover, Linux 0.01 isn't even a very good resource for learning about the Linux kernel. It predates much of the modern organization of the kernel, and as such is significantly different from modern kernels. In particular:
Kconfig is not present. Linux 0.01 had no configuration options at all, and was built using hand-written Makefiles.
There is no arch directory yet. Linux 0.01 would only build and run on x86 systems.
There is no drivers directory either. The system only supported a few built-in system devices, such as the hard disk and keyboard, and those were essentially hard-coded into the kernel directory.
There is no support for SMP systems, nor any form of locking or kernel preemption. Multiprocessor x86 systems were extremely rare when Linux 0.01 was released, so Linus didn't have one to test on.
Many commonly used macros and structures in the modern Linux kernel, such as struct list, are not yet present. There wasn't a need for them yet.
Trying to use this extremely early version of Linux for learning purposes is not a good introduction to Linux kernel programming. If you want to learn, you should really work with a current version.
You don't need a cross-reference site. If you have a copy of the source code, download and use cscope. It's a great tool for searching C programs; I'm sure you'll find it useful.

Is it possible a unix or linux for 80286 machine (or any machine without memory page mechanism)

Is it possible to have a Unix OS for 80286 machine (or any machine without paged memory mechanism but with segmented memory)?
80286 is a CPU without TLB, Page tables; only with segmented virtual memory and segmented protection of memory.
Is it possible to have a Linux on such machine?
UPD: the processor is very old, so I only ask about historic versions, not the ultra modern linux 2.6.42.11 or Solaris 13 or FreeBSD 10 or ...
The Linux/Microcontroller project (µClinux) is a port of Linux to systems without a Memory Management Unit (MMU).
There's the older ELKS project too.
However, due to the lack of MMU, many standard UNIX features (like fork and mmap) are not supported.
Today's Linux will only compile for a 486 or higher. So it's unlikely. I do remember 386s being somewhat supported in the 2.4.x era, but I don't remember anything about 286s.
User Zack says that Xenix (based on original UNIX) was capable of running on 80286:
There certainly were Unixes that ran on the 80286 -- Xenix comes to mind -- but I don't know if there's anything that implements what you would call a modern programming environment.
I'd checked, the Xenix FAQ http://www.uni-giessen.de/faq/archiv/sco-xenix/msg00000.html says
QA1 ... The PC/AT offered hardware memory protection, and SCO Xenix/286 took advantage of it.
So it was a PC/AT (80286) unix, which did used a memory protection using segmented memory (unlike modern unixes which use page based memory protection).
According to http://www.deinmeister.de/x86modes.htm 80286 have memory protection only in terms of segments, not a pages (pages was added in 80386).
Not sure how interested you are in the programming of it (if at all), but I was playing around with OpenCourseWare class from MIT awhile ago and they had a version of Minix they ported to x86 (not sure if it was just for 386+ or not and can't seem to find the link anymore). Anyway, if you're interested you can check it out here: MIT OpenCourseWare Operating System Engineering
I doubt so. From the very beginning, Linux was designed for the 386, using 386-specific features. MINIX, on the other hand, predates the 386 (and 286), so there should be a 286-compatible version out there.

What scheduling algorithms does Linux kernel use?

What scheduling algorithms does Linux kernel use?
Where can I get more info about linux's kernel? (OS first course... student level)
The linux kernel has several different available scheduling algorithms both for the process scheduling and for I/O scheduling. Download it from www.kernel.org and call
make menuconfig
You will get a full list of all available options with a built-in help.
One guy that once came up with his O(1) scheduler is Con Kolivas. Definitively have to have a look at what he did. I was once a great break-through.
Note: As Abdullah Shahin noted, this answer is about IO queing scheduler, not for processes.
If you just want to check what scheduler your linux system is using and which are available you can run the following command:
cat /sys/block/sda/queue/scheduler
The one between the [] is the one it's using at the moment. The other ones are available.
To change it:
sudo bash -c 'echo deadline > /sys/block/sda/queue/scheduler'
Be carefull to set it back to default though, unless you know what you are doing and want.
Default (in newer Ubuntu distros at least) is CFQ (Completely Fair Scheduling):
http://en.wikipedia.org/wiki/CFQ
Interview with the creator (Jens Axboe):
http://kerneltrap.org/node/7637
As others have already mentioned, there are several scheduling algorithms available, according to the intended use.
Check this article if you want to learn more about scheduling in Linux.
i believe "completely fair scheduler" is in use with latest kernels. I think you can good amount of information if you just search for it in google.
link : http://en.wikipedia.org/wiki/Completely_Fair_Scheduler
A new addition to Linux Kernel is EDF (Earliest Deadline First) for guaranteed RealTime support
http://lkml.org/lkml/2009/9/22/186
http://www.evidence.eu.com/content/view/313/390/
I think the Linux kernel actually has a few different schedulers you can choose from at compile-time. To find out more about the Linux kernel, you can download the kernel source code (or browse it online) and look in the Documentation directory. For example, the scheduler subdirectory might be helpful. You can also just look at the code itself, obviously.
Modern GNU/Linux distributions use CFS (Completely Fair Scheduler). You may read more on that in the 4th chapter of this book:
Linux Kernel Development 3rd Edition by Robert Love
You will find many interesting and easy to understand explanations there. I enjoyed a lot.
Linux Kernel allows three different scheduling algorithms mainly
shortest job first
Round Robin Scheduling
Priority based preemptive scheduling algorithm.
The third scheduling method which it differs with lower version of Linux versions such as 2.4

thread performance on Linux vs. Solaris

This Linux Magazine article http://www.linux-mag.com/id/792 explains the difference in the way threads are implemented in Linux as compared to commercial Unixs such as Solaris. In summary, Linux uses a 1-to-1 mapping of user threads to kernel threads, while Solaris uses a many to many mapping. The article implies that this might give Solaris a performance edge, especially when switching between threads. Before I spend the time to test this, has anyone already done it?
People used to think that M:N threading was a good idea, but everyone has been moving to 1:1 threading; it has lower overheads and works better in an SMP environment. Solaris moved from M:N threading to 1:1 threading in Solaris 9, I believe. That article you linked to seems to be from 2001, so it's a bit outdated (it's subscriber only, so I couldn't read it).

Resources