|
If he's porting a design where the threads think they're running under the same process, whose id they will all return, that design will have to be reworked.
If threads actually remap memory in the way that processes do, context switching between threads would be far more expensive. OP works on embedded systems where this could be unacceptable.
Having to drop into kernel mode to acquire or release a mutex is another overhead. If threads poll a mutex, that's about as idiotic as it gets if it's truly a spinlock. Having to introduce a condition variable (which has problems of its own) to avoid this would be yet another non-portable overhead.
I would bet that somewhere, someone implemented lightweight threads on Linux. The change may have been rejected by a collection of bozos, in which case it might be available as a variant from some vendor.
|
|
|
|
|
I'm shocked at this. I have done a huge amount of multi-threaded stuff under Windows which was fairly easy to do, coordinating the threads, etc. I happened to not have done any of this under Linux so I never realized how hard this would be. I'll stick to Windows a little longer I think.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
One thing I noticed pretty soon is the lack of a wakeable sleep. I used to pace my threads with wakeable Sleeps, so that I had instant response when I needed it and ensured a periodical run if anything went wrong.
Also asynchronous I/O requires a lot more boilerplate code wrt the magnificient Win32 API. Yes, they are harder to learn, but they make writing async I/O code a breeze.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Totally off the top of my head, but Linux, like it's UNIX parent, seems to try to make "everything" look the same. Making it a process, although involving addition overhead in your coding may give it some advantages. If he parent keeps track, as well it should, it keeps working.
What abilities does a process have, or avail itself of, that would not be available if the subprocess were as in Windows. For example, and I don't know why one would do it except to stop a train wreck, one can access a process and stop it uniquely even from outside the application.
Usually, Linux is based upon enabling. What can you do now that you couldn't before (and since you couldn't you'd not think about doing it).
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I think you simply need to learn more about Linux threads. It's not worse, it's just different.
|
|
|
|
|
If the descriptions in this thread are accurate, it's different and worse, at least if you care about portability and performance.
|
|
|
|
|
Definitely. So far I'm using just the pthread library to keep thnigs basic enough to not run into issues when I will deploy the component on the board it will run into (very basic Poky build).
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
If you google for "linux parent pid" you will find that you can indeed get the parent pid. Programmatically Speaking: Find parent pid given a pid[^]
The Windows concept of Critical Section "protects code". One can easily get accustomed to this view, but in fact you never need to "protect code", what you need to protect is resources (memory, file handles, etc). Linux has something called spin-locks, which are lightweight mutexes. Kernel Locking Techniques | Linux Journal[^]
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
I've only heard of spinlocks being used in SMP systems while waiting for another processor to finish using shared memory. The memory might be used, for example, to avoid the overhead of the IP stack during interprocessor messaging. It's a reasonable design if the spinning is always brief, because the spinning processor is literally twiddling its thumbs while waiting.
|
|
|
|
|
megaadam wrote: If you google for "linux parent pid" you will find that you can indeed get the parent pid. Programmatically Speaking: Find parent pid given a pid[^] Documentation states that getppid returns the controller thread pid, which is an additional thread by Linux created the first time a thread for a process is created. Now, I don't need that info now but I find it a flaw in the architecture of a thread - indeed the same documentation specifies that a thread is just a process which overshares. The fact is, if I wanted a process, I would have used a process. I'm used to an entirely different concept of thread and it baffles and irks me.
megaadam wrote: Linux has something called spin-locks, which are lightweight mutexes. Busy forms of waiting are useful in some cases but often they are wasteful. I felt the lack of true spinlocks in older Windows (being forced to target XP or even 2K sucked big time) when I was doing user-mode hardware management, but I don't want to use a system where there are only spinlocks.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Every press article I have read about Windows 11 (mainly by people who can't spell 'PC' but want to jump on the bandwagon) has gone on about TPM and centralised taskbars, but none have said what versions of W11 there will be. So, my question is ... will there be a W11 Home and a W11 Pro or just a single W11 generic version?
I have just bought a new PC (prev one is too old for latest W10 updates) with W10 Home on it and I have had an Amazon 'based on your recent views ...' message for a cheap W10 Pro license. So if W11 is likely to be a free upgrade from W10 and has a W11 Pro variant, it would probably be best to upgrade my new PC to W10 Pro to get W11 Pro when it comes out. If there isn't a W11 Pro, then it would be best to stick with W10 Home (no risky upgrade, no charge for new license) and get the generic W11 instead.
Also, I don't get the need for TPM. I cannot imagine a thief is going to take the effort to dismantle a PC just to steal the drive knowing it would be unreadable, when it would be quicker and easier to steal the whole PC which has the bonus that the drive remains readable.
|
|
|
|
|
jsc42 wrote: Also, I don't get the need for TPM. I cannot imagine a thief is going to take the effort to dismantle a PC just to steal the drive knowing it would be unreadable Too often POS and bank workstation drives are dumped without any physical destruction of the contents, exposing tons of potentially sensible data. Also corporate espionage is a thing, especially when outsourcing and consultancy are widely used.
jsc42 wrote: will there be a W11 Home and a W11 Pro or just a single W11 generic version? I ing hope they ditch the versioning for the OS, it creates the worst compatibility issues with no reason at all.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Versions?
Versions=$
You can't join a system with Home version to a domain. Businesses need domains.
So, to do away with versions, they can make the new version the price of the Pro version or they can make it the price of Home. Hmm, what to do with the Workstation version?
Any bets?
I think a bigger question would be about any new licensing for running in a VM.
>64
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
Yes, but also businesses have usually discounted and bulk prices (small business most often than not don't have domains at all anyway and use the Home edition), and maintaining more versions has a higher cost thant maintaining one.
I can understand a Server version, but Home and Pro should be unified.
I still have nightmares with the horrible Win7 version hell: Starter, Basic, Home, Pro, Ultimate and a couple of others. The compatibility issues I had are the stuff successful horrors are made of.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
|
|
Dan Neely wrote: Home is making an MS account mandatory, and will prevent any internetless install as a result. WTAF??? They are practically begging to have their vulnerabilities ethically exposed and exploited, purely as a proof of concept.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
I'm still undecided if that, or threatening to block any computers more than about 3 years old from upgrading is the most ing stupid thing they've done.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
|
|
|
|
|
My laptop will soon turn 5. It still suits my purposes, but maybe it's time to get a new one before they all come with Windows 11.
|
|
|
|
|
Or buy a retail copy of Win10 with a license key. I think you can still do that, but Uugh!
|
|
|
|
|
hello sir i am working on stm8s105 microcontroller, actually i wrote the codefor l89 gps module with uart communication , but i want to interface with i2c protocal , can you suggest how to do
|
|
|
|
|
Well you could start by learning to read the messages that tell you that this forum is not for programming questions; you should use https://www.codeproject.com/Questions/ask.aspx[^]. But you will need to provide much more detail about your problem, as no one here can guess what your difficulty is.
|
|
|
|
|
Hmm, I might be able to help. Ask the question as Richard says ...
|
|
|
|
|
Really, have you been dealing with these small microcontrollers as well ?
|
|
|
|
|
Not them as such, but I have battled I2c for many years. Check your pull ups
|
|
|
|