• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

cant we create an OS in Java ?

capybara

Senior member
1. unix and linux and written in c / c++
2. but c/ c++ doesnt have built-in buffer overload protection
3. anything written in c / c++ can be written in java
4. java has built-in buffer overload protection
5. someone should write an OS that is "unix-like" but in java
 
Humm, There is one big problem with writing a program in Java. It, Would, Be, Very, S, L, O, W,. Writing an OS in Java for the sole reasion of protecting agenst buffer Overflows would be a waist of time. Also, It is not just as easy as copying the c/c++ source code and using a java compiler. you would have to completly rewrite every line of linux code to the java equivilent. Sorry, but saying someone should write a os in java is like (to me) saying someone should write an OS in VB.
 
Originally posted by: Haden
OS is very hardware specific and Java apps run on virtual machine.
I don't get your idea.

True. The whole point behind java to was to create a level of abstraction between the hardware and the software, enabling the code to run on any platform, provided that the virtual machine has been implemented for that platform.
 
the real underlying thought is that java is a high level language...whether you write your OS in java, C, C++ etc you still have to get it into machine code to run on the cpu. Because java runs in a virtual machine...its not true x86 based machine code. It wouldnt run on any cpu except the one that the java interpreter emulates.
 
Sun actually has a CPU that executes Java bytecode directly. MAJC. It's mainly aimed at embedded platforms.

 
Originally posted by: AbsolutDealage
Originally posted by: Haden
OS is very hardware specific and Java apps run on virtual machine.
I don't get your idea.

True. The whole point behind java to was to create a level of abstraction between the hardware and the software, enabling the code to run on any platform, provided that the virtual machine has been implemented for that platform.

....which strikes me as somewhat dumb... why not just define a standard IMPLEMENTABLE architecture, say MIPS and compile to that? The rest of the machines can emulate it, which they do anyway for java (well, compile at runtime... same idea), and the actual machines can run code fast. It's not like half-compiled bytecode buys you much beyond the ability to optimize your JVM for your hardware.
 
Number 3 is wrong. As specific examples, device drivers and virtual memory management code would be impossible to write in java.

Another thing to consider is that most of your standard java packages, including even java.lang, are NOT written in java, they are JNI calls to C++ DLLs. If they were in java the language would be many times slower than it is.

An OS written in Delphi wouldn't be such a bad idea.... dynamic sized strings in that can be like 2GB, so it would be hard to overflow them and manipulating them is in many cases faster than C/C++. If you look at it almost all buffer overflows are from user-input strings being read into static character arrays.
 
More resent ARM cores have a hardware vurtial machine built in so they execute the code in hardware all the time
 
There are many different techniques currently being implemented (namely in OpenBSD) to stop buffer overflows in their tracks. C is not necessarily the problem. However, it will probably be a long time before these are common in linux, much less windows (where exploits seem to be most damaging to the internet as a whole).
 
you can write anything in java. the compiling process is where things differ. java's main weakness is the JVM, and that's supposed to make java so portable (java's strength). sloppy java code causes the jvm to appear buggy. and the jvm is not much either.

now, obviously a native java OS wont require a "jvm" since the jvm MUST be part of the kernel. if one were to make a java OS, it will run like crap. why? because it would have to use a processor which can make use of jbc (see above post). if not, the jvm would be used to translate, which is partially why jvm is a weakness.

programs are compiled to the processor's instruction set simply because it would run SLOW AS HELL otherwise.

--

device drivers can be created in java, obviously no idiot is going to compile it to jbc.
 
Originally posted by: Mday
device drivers can be created in java, obviously no idiot is going to compile it to jbc.

Bytecode or not, you have no mechanism for reading/writing specific memory addresses, and don't have any direct access to hardware ports or any means to write an interrupt handler. So no, device drivers can't be written in java.

 
Originally posted by: glugglug
Originally posted by: Mday
device drivers can be created in java, obviously no idiot is going to compile it to jbc.

Bytecode or not, you have no mechanism for reading/writing specific memory addresses, and don't have any direct access to hardware ports or any means to write an interrupt handler. So no, device drivers can't be written in java.

Which is why the Virtual machine approach was chosen in the first place, to completely seperate the compiled code and the hardware. They purposely made it so that you have absolutely no direct control over the hardware.
 
Isn't this like the tail wagging the dog? Java was meant to run on all platforms through a vm- but to make a platform-independent platform? Esp. since it would need to run on a special hardware platform? Now I'm confused. =)
 
I think our questioneer is a bit confused and now i am realising why... we use one word (java) to mean to different things...

There is Java the Programming language... which is merely the fron end for programmers to use...
Then there is java the technology... which is a programming means for creating platform independent software by using a virtual machine (which must run on all available hardware & OS's)

The link between the two is compilation and linkage...

You could write an OS in Java the programming language if you had a java compiler which would then compile the program into machine code which would run on a some sort of standardized hardware architecture. Except i am not sure if such a compiler/linker exists...

Or

It would be of little/no benefit to write a OS which would run on Java technology. Thats just virtual machining a computer. This has already been done, by the creators of VMware (not written in Java, but a more higher performance language) Virual machines are slow, inefficient etc...
 
Originally posted by: glugglug
Number 3 is wrong. As specific examples, device drivers and virtual memory management code would be impossible to write in java.

Another thing to consider is that most of your standard java packages, including even java.lang, are NOT written in java, they are JNI calls to C++ DLLs. If they were in java the language would be many times slower than it is.

An OS written in Delphi wouldn't be such a bad idea.... dynamic sized strings in that can be like 2GB, so it would be hard to overflow them and manipulating them is in many cases faster than C/C++. If you look at it almost all buffer overflows are from user-input strings being read into static character arrays.
I believe your second assertion is completely false. Most of the Java platform libraries, and even the massive J2EE stack are "Pure Java" code. Certain things are implemented in JNI for obvious reasons, but as time goes by, the JVM obviates that. As one example, java.math used to be natively implemented, but was rewritten in Java in Java2 1.3.

Sun and IBM wrote JavaOS a while back, and decided there pretty much wasn't a market for it.
 
Seems to me that you're talking about/looking for an OS similar to Tao-groups Elate...? I.e write once/run anywhere?

Keill...

 
Originally posted by: manly
Originally posted by: glugglug
Number 3 is wrong. As specific examples, device drivers and virtual memory management code would be impossible to write in java.

Another thing to consider is that most of your standard java packages, including even java.lang, are NOT written in java, they are JNI calls to C++ DLLs. If they were in java the language would be many times slower than it is.

An OS written in Delphi wouldn't be such a bad idea.... dynamic sized strings in that can be like 2GB, so it would be hard to overflow them and manipulating them is in many cases faster than C/C++. If you look at it almost all buffer overflows are from user-input strings being read into static character arrays.
I believe your second assertion is completely false. Most of the Java platform libraries, and even the massive J2EE stack are "Pure Java" code. Certain things are implemented in JNI for obvious reasons, but as time goes by, the JVM obviates that. As one example, java.math used to be natively implemented, but was rewritten in Java in Java2 1.3.

Sun and IBM wrote JavaOS a while back, and decided there pretty much wasn't a market for it.

Out of curiosity I went and downloaded the latest java2 source & parsed it, and came up with the following counts of JNI methods from each java file. Its a lot less than I expected, not sure if this is from java technology improving, or from faster computers making it practical to do more in the JVM:

27 java/util/prefs/WindowsPreferences.java
24 com/sun/corba/se/internal/io/IIOPInputStream.java
23 java/lang/Class.java
21 java/security/cert/X509CertSelector.java
21 java/lang/reflect/Array.java
18 java/net/PlainDatagramSocketImpl.java
17 com/sun/corba/se/internal/corba/TypeCodeImpl.java
16 java/io/Win32FileSystem.java
15 java/lang/StrictMath.java
15 java/io/WinNTFileSystem.java
15 com/sun/corba/se/internal/core/CodeSetComponentInfo.java
14 java/lang/Thread.java
12 java/util/zip/ZipFile.java
12 java/net/PlainSocketImpl.java
12 java/lang/ClassLoader.java
12 com/sun/corba/se/internal/io/IIOPOutputStream.java
11 java/io/RandomAccessFile.java
11 com/sun/imageio/plugins/jpeg/JPEGImageReader.java
10 com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
10 com/sun/corba/se/internal/core/CodeSetConversion.java
9 java/util/zip/Inflater.java
9 java/util/zip/Deflater.java
9 java/lang/System.java
9 java/lang/Runtime.java
8 java/nio/Bits.java
7 java/lang/Object.java
7 java/lang/Compiler.java
7 java/io/FileInputStream.java
7 java/awt/datatransfer/SystemFlavorMap.java
6 java/security/AccessController.java
6 java/io/FileOutputStream.java
6 java/awt/Component.java
5 javax/swing/RepaintManager.java
5 java/net/NetworkInterface.java
5 java/lang/Win32Process.java
5 java/lang/SecurityManager.java
5 java/awt/KeyboardFocusManager.java
4 javax/print/PrintServiceLookup.java
4 javax/imageio/spi/ImageReaderWriterSpi.java
4 java/awt/Font.java
4 java/awt/Container.java
4 com/sun/imageio/plugins/jpeg/JPEG.java
4 com/sun/corba/se/internal/io/ObjectStreamClass.java
3 org/omg/CORBA/TypeCode.java
3 org/omg/CORBA/TCKind.java
3 java/text/Bidi.java
3 java/nio/MappedByteBuffer.java
3 java/net/Inet6AddressImpl.java
3 java/net/Inet4AddressImpl.java
3 java/lang/Throwable.java
3 java/lang/Float.java
3 java/lang/Double.java
3 java/io/ObjectInputStream.java
3 java/awt/print/PrinterJob.java
3 java/awt/JobAttributes.java
3 java/awt/Cursor.java
3 com/sun/java/swing/plaf/windows/XPStyle.java
3 com/sun/corba/se/internal/io/LibraryManager.java
3 com/sun/corba/se/internal/corba/ORB.java
2 javax/imageio/metadata/IIOMetadata.java
2 java/util/zip/ZipEntry.java
2 java/util/zip/CRC32.java
2 java/util/zip/Adler32.java
2 java/util/TimeZone.java
2 java/security/cert/X509Certificate.java
2 java/net/SocketOutputStream.java
2 java/net/SocketInputStream.java
2 java/net/InetAddress.java
2 java/lang/Shutdown.java
2 java/lang/Package.java
2 java/io/ObjectStreamClass.java
2 java/io/ObjectOutputStream.java
2 java/io/FileDescriptor.java
2 java/awt/image/ColorModel.java
2 java/awt/AWTEvent.java
2 com/sun/corba/se/internal/orbutil/ObjectStreamClass_1_3_1.java
2 com/sun/corba/se/internal/DynamicAny/DynAnyUtil.java
2 com/sun/corba/se/internal/corba/TCUtility.java
2 com/sun/corba/se/internal/corba/ORBSingleton.java
2 com/sun/corba/se/internal/corba/AnyImpl.java
1 org/omg/DynamicAny/DynAnyFactoryOperations.java
1 org/omg/DynamicAny/_DynAnyFactoryStub.java
1 org/omg/CORBA/portable/ValueFactory.java
1 org/omg/CORBA/ORB.java
1 org/omg/CORBA/DATA_CONVERSION.java
1 org/apache/xpath/res/XPATHErrorResources_sv.java
1 org/apache/xml/utils/synthetic/Class.java
1 org/apache/xml/utils/FastStringBuffer.java
1 org/apache/xalan/res/XSLTErrorResources_sv.java
1 javax/swing/text/View.java
1 javax/swing/text/DefaultCaret.java
1 javax/print/PrintService.java
1 javax/print/DocPrintJob.java
1 javax/print/Doc.java
1 javax/naming/CompositeName.java
1 java/util/ResourceBundle.java
1 java/util/logging/FileHandler.java
1 java/util/jar/JarFile.java
1 java/sql/DriverManager.java
1 java/sql/Connection.java
1 java/nio/DirectByteBuffer.java
1 java/nio/channels/FileLock.java
1 java/nio/ByteOrder.java
1 java/nio/ByteBuffer.java
1 java/net/Inet6Address.java
1 java/net/Inet4Address.java
1 java/net/DatagramPacket.java
1 java/lang/String.java
1 java/lang/StackTraceElement.java
1 java/lang/reflect/Proxy.java
1 java/lang/reflect/Modifier.java
1 java/lang/ref/Finalizer.java
1 java/io/FileSystem.java
1 java/io/FileNotFoundException.java
1 java/awt/Window.java
1 java/awt/Toolkit.java
1 java/awt/TextField.java
1 java/awt/TextArea.java
1 java/awt/ScrollPaneAdjustable.java
1 java/awt/ScrollPane.java
1 java/awt/Scrollbar.java
1 java/awt/Rectangle.java
1 java/awt/Paint.java
1 java/awt/MenuItem.java
1 java/awt/MenuComponent.java
1 java/awt/MenuBar.java
1 java/awt/Menu.java
1 java/awt/Label.java
1 java/awt/Insets.java
1 java/awt/image/SinglePixelPackedSampleModel.java
1 java/awt/image/SampleModel.java
1 java/awt/image/Raster.java
1 java/awt/image/Kernel.java
1 java/awt/image/IndexColorModel.java
1 java/awt/image/ComponentSampleModel.java
1 java/awt/image/BufferedImage.java
1 java/awt/GradientPaint.java
1 java/awt/Frame.java
1 java/awt/FontMetrics.java
1 java/awt/FileDialog.java
1 java/awt/event/MouseEvent.java
1 java/awt/event/KeyEvent.java
1 java/awt/event/InputEvent.java
1 java/awt/Event.java
1 java/awt/dnd/DropTarget.java
1 java/awt/Dimension.java
1 java/awt/Dialog.java
1 java/awt/Color.java
1 java/awt/CheckboxMenuItem.java
1 java/awt/Checkbox.java
1 java/awt/Button.java
1 java/awt/AWTKeyStroke.java
1 com/sun/security/auth/module/UnixSystem.java
1 com/sun/security/auth/module/SolarisSystem.java
1 com/sun/security/auth/module/NTSystem.java
1 com/sun/naming/internal/FactoryEnumeration.java
1 com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
1 com/sun/imageio/plugins/png/PNGMetadata.java
1 com/sun/corba/se/internal/util/JDKClassLoader.java
1 com/sun/corba/se/internal/util/JDKBridge.java
1 com/sun/corba/se/internal/orbutil/resources/sunorb_de.java
1 com/sun/corba/se/internal/orbutil/ORBConstants.java
1 com/sun/corba/se/internal/orbutil/ObjectStreamField.java
1 com/sun/corba/se/internal/orbutil/ObjectStreamClassUtil_1_3.java
1 com/sun/corba/se/internal/io/ValueUtility.java
1 com/sun/corba/se/internal/io/ObjectStreamField.java
1 com/sun/corba/se/internal/DynamicAny/DynAnyBasicImpl.java
1 com/sun/corba/se/internal/corba/ServerDelegate.java
1 com/sun/corba/se/internal/corba/ClientDelegate.java
 
Back
Top