Why does Windows have Native API? [closed] - operating-system

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Why does modern os implement a kind of hirarchy of calling internal functions?
like in windows when you call ReadFile function you acually call to NtReadFile.
Why doesnt windows call directly into NtReadFile?
What will happen if the os will call into internal function directly?

The current version of Windows is based on Windows NT, which was started in 1989. Back then they didn't know what OS/API would be popular so they designed Windows NT to have a generic native API (NtReadFile) and multiple subsystems (Windows, POSIX, OS/2) that would translate calls into that native API.
In 1989 Windows was not popular, and the designers intended that OS/2 would be the primary subsystem. It was only after Microsoft left the OS/2 partnership with IBM and Windows 3.0 came out in 1990 and became very popular that they decided to make a Windows subsystem. As a result, the Win32 subsystem was created to translate calls like ReadFile into NtReadFile.

Decoupling and legacy. You have to remember that NT was originally designed as a microkernel that would support multiple APIs on top of it, with the default API of course being the already established WIN32 API.
If you call NtReadFile directly you are no longer using the WIN32 API.

Related

Which Framework/Package to use for Swift Linux that also can be used for Vapor [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I've written an API-Wrapper for an external REST-API. This wrapper provides iOS and macOS-Apps an convenient access to that API.
But I want to expand that API-Wrapper to Vapor on Linux.
Linux (RaspiOS with 64-Bit) has Swift 5.5 running (without swift-corelibs-foundation) so URLSession is not available. I tried SwiftyRequest and AsyncHTTPClient but both did not play well with Vapor. E.g. wait() can't be used with Vapor and whenComplete() draws error * underlying error: uncleanShutdown* while syncShutdown can't be used for the same reason as wait()
So I'm stuck with connecting to the API.
What would be a proper way to perform the request that works standalone and with vapor?
Vapor has a Client protocol you should use if using Vapor but that's built on top of AsyncHTTPClient. You're correct in that you can't use wait() if you're on an event loop but you should use future handlers (or even better the new async/await APIs). What part is reporting unclean shutdown? If that's coming from AsyncHTTPClient then the API you're calling isn't closing the connection properly but you can configure it to ignore this.
As an aside, Vapor requires Foundation so you'll need that to be able to build it anyway

AllenBradley Compactlogix PLC Ethernet IP & C# Communication? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have Compact Logix Ethernet/Ip PLC. I want to make small scada/hmi on my pc with C#. I can use visual studio 2017 windows forms. I will take some data from plc to pc and I will show on c# and changed some picture image.
how can I do communication C# and Allen Bradley PLC via ethernet/IP. I need your helps, sample programs, libraries, support, advises.
Look at AdvancedHMI. It is an HMI/SCADA Visual Studio toolkit with AB drivers. You can do most HMI stuff without writing code, but you can also use VB or C# for advanced tasks.
Look at EEIP Library. They have a C# and Java library for Ethernet/IP communication. They even offer some videos on YouTube on how to use it. But be aware, that some of this free libraries have some rough edges or bugs with them. Personally, I would use Modbus or another PLC before using Ethernet/IP along with a PC.
There is an open-source project called libplctag which has a few .NET wrappers, some of which are on nuget: https://www.nuget.org/packages/libplctag/, https://www.nuget.org/packages/PlcTag.Net/
Full disclosure: I'm one of the authors of the first wrapper.

Do libraries exist for building operating systems? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So I'm curious about this. I assume the building of operating systems is a monumental task, especially with all the back end stuff that an os involves. I was curious if I wanted to rework the front end of an operating system, but take advantage of existing architecture/backend, what would be the best resources to use? Also, can you guys point to any examples of well designed front ends of operating systems that aren't really mainstream? It seems like everyone uses pretty large well known OS.
Yes, you can. But like you said, it's a huge, huge task. I am not sure of windows or mac, but in Linux you have options to do so. You can download a Kernel from https://www.kernel.org/ and write applications around it.
If your goal is to make applications around the kernel, then look at linux application development resources. Check out linux desktop environments https://en.wikipedia.org/wiki/Desktop_environment#History_and_common_use to see which one is good.

Should I write a cross-platform service in Go? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm looking into writing a cross-platform (Windows/Debian/Darwin/Red Hat) service and am comparing language options. I really appreciate Go's cross-platform threading abilities and easy cross-compiling, but I want to make sure I'll be able to easily reach any native (eg. Windows Service) APIs when needed.
What sort of things should I be considering to drive my language decision?
Go has full support for calling into arbitrary Win32 API's via its core syscall package.
While calling out to raw Win32 via syscall is not exactly pretty to write (mostly because you're crossing the managed/unmanaged boundary, and back) and has no support from the compiler (akin to, say, that of Delphi), this works just OK, and generation of wrapper functions for such API calls can be automated—the Go core packages use this facility for themselves, other popular examples include the odbc package.
Note that there already exists winsvc—a library which interfaces Go with the Windows SCM and event log.
Also look at service which provides unified API for turning your program into a daemon/service using platform-native tools (it uses winsvc on Windows, IIRC).

Why did Windows NT move away from the microkernel? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm told, that Windows NT was first designed to implement the microkernel architecture, but moved away to hybrid kernel.
What caused the change? I'm having trouble trying to find any info about this.
The main reason that Windows NT became a hybrid kernel is speed. A microkernel-based system puts only the bare minimum system components in the kernel and runs the rest of them as user mode processes, known as servers. A form of inter-process communication (IPC), usually message passing, is used for communication between servers and the kernel.
Microkernel-based systems are more stable than others; if a server crashes, it can be restarted without affecting the entire system, which couldn't be done if every system component was part of the kernel. However, because of the overhead incurred by IPC and context-switching, microkernels are slower than traditional kernels. Due to the performance costs of a microkernel, Microsoft decided to keep the structure of a microkernel, but run the system components in kernel space. Starting in Windows Vista, some drivers are also run in user mode.