Jump to content

Can i write a linex mini kernel using python or at least rewrite one ???

Go to solution Solved by pythonmegapixel,
3 minutes ago, ken00H said:

Can you tell what kind of hardware???

I don't know specifically. The reason I made that comment is that when Java was the trendy language, it needed a specific runtime environment (the Java Virtual Machine) which was most often implemented in software - however, I believe there were a few chips that implemented a JVM in hardware instead, allowing you to run Java on the bare metal.

 

Theoretically, it might be possible to have a chip which can interpret Python bytecode in hardware in a similar way. I doubt any such thing actually exists, as it's not clear what the use for it would be, but even if you did, the end result would probably be a very long way from Linux.

 

As @trag1csays, you really need a language that compiles/assembles to machine code.

Hello guys i am an IT student and i was wondering if i can use python to write a Linux mini kernel or at least rewrite one

 

 

 

and sorry for any mistakes in my writing English isn't my main language

Link to comment
Share on other sites

Link to post
Share on other sites

No. Python is too high-level to write a kernel in (apart from perhaps some extremely specialised hardware).

There has to be some form of operating system there already for the Python interpereter to run on top of.

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to comment
Share on other sites

Link to post
Share on other sites

Can you tell what kind of hardware???

1 minute ago, pythonmegapixel said:

No. Python is too high-level to write a kernel in (apart from perhaps some extremely specialised hardware).

There has to be some form of operating system there already for the Python interpereter to run on top of.

 

Link to comment
Share on other sites

Link to post
Share on other sites

If you want to build your own kernel from scratch you would need a language that compiles directly to machine code like C or C++. Python to my knowledge doesn't have any options for compiling straight into machine code. Python can be compiled to byte code but that doesn't help since that byte code still has to be interpreted. 

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, ken00H said:

Can you tell what kind of hardware???

I don't know specifically. The reason I made that comment is that when Java was the trendy language, it needed a specific runtime environment (the Java Virtual Machine) which was most often implemented in software - however, I believe there were a few chips that implemented a JVM in hardware instead, allowing you to run Java on the bare metal.

 

Theoretically, it might be possible to have a chip which can interpret Python bytecode in hardware in a similar way. I doubt any such thing actually exists, as it's not clear what the use for it would be, but even if you did, the end result would probably be a very long way from Linux.

 

As @trag1csays, you really need a language that compiles/assembles to machine code.

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, trag1c said:

If you want to build your own kernel from scratch you would need a language that compiles directly to machine code like C or C++. Python to my knowledge doesn't have any options for compiling straight into machine code. Python can be compiled to byte code but that doesn't help since that byte code still has to be interpreted. 

it isn't about making my own kernel

i thought if i can do it i will do it for my graduation project

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, pythonmegapixel said:

I don't know specifically. The reason I made that comment is that when Java was the trendy language, it needed a specific runtime environment (the Java Virtual Machine) which was most often implemented in software - however, I believe there were a few chips that implemented a JVM in hardware instead, allowing you to run Java on the bare metal.

 

Theoretically, it might be possible to have a chip which can interpret Python bytecode in hardware in a similar way. I doubt any such thing actually exists, as it's not clear what the use for it would be, but even if you did, the end result would probably be a very long way from Linux.

 

As @trag1csays, you really need a language that compiles/assembles to machine code.

Ok i understand it now

do you have any ideas for me to code as a graduation project  instead???

Link to comment
Share on other sites

Link to post
Share on other sites

24 minutes ago, ken00H said:

Ok i understand it now

do you have any ideas for me to code as a graduation project  instead???

My best advice would be to find a problem to solve that can make your life easier or find a friend with a business or something and then see how you can help them.

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, ken00H said:

Ok i understand it now

do you have any ideas for me to code as a graduation project  instead???

No offense but if you're this close to graduation in IT and you don't realize why writing a kernel in python is not feasible you might have a problem. Maybe expand on something you did study in a course for your graduation project...?

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

You can write your own kernel in anything you want. And it can run on anything you want, even in a "virtual machine" you code in whatever you want, too.

Just have to implement the basics of what you want your kernel to handle.

Not talking running Firefox or even a network stack, just "booting" to something and handling some basics like semaphores, memory allocation/deallocation  and stuff like that.

Check out Minix

https://www.amazon.com/Operating-Systems-Design-Implementation-3rd/dp/0131429388

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×