Question

In: Computer Science

we discussed how C library translates a C lib function such as open to sys_open. It...

we discussed how C library translates a C lib function such as open to sys_open. It is easy to understand how this works for a C program. However, does this still apply to Java programs? State your reasoning with evidence.

Solutions

Expert Solution

Yes, this also applies to Java Programs as well because system calls are the only way that an OS allows access to any program.

The standard pattern says that some methods in a Java class are labelled as "native". When the JVM meets a call to a native method, JVM calls into C/C++ code that is part of the JVM executable. The native method is implemented in the following way:

  1. Parameters or arguments from Java, translated into C / C++ compatible form.

  2. Call to the standard C / C++ library function with the parametsr/arguments it needs.

  3. The library function makes a syscall.

  4. The Operating System does its work and the syscall returns.

  5. The standard C / C++ library function returns.

  6. The native method implementation translates the results into Java objects and returns them to the caller of the Java method.

When applied to Java, this is the reason why some OS-specific features show through, A Java program developed on the windows platform, may fail on the Linux platform (Though it is not always true).


Related Solutions

note: USE C++ WITH USER DEFINED FUNCTIONS AND RECURSIVE FUNCTION ONLY. No C++ library function is...
note: USE C++ WITH USER DEFINED FUNCTIONS AND RECURSIVE FUNCTION ONLY. No C++ library function is allowed. The game of “Jump It” consists of a board with n positive integers in a row, except for the first column, which always contains zero. These numbers represent the cost to enter each column. Here is a sample game board where n is 6: 0 3 80 6 57 10 The object of the game is to move from the first column to...
Write pseudocode for a function that translates a telephone number with letters in it (such as...
Write pseudocode for a function that translates a telephone number with letters in it (such as 1-800-FLOWERS) into the actual phone number. Use the standard letters on a phone pad
Please show in EXCEL how to express with function formula. As we discussed during Week 3,...
Please show in EXCEL how to express with function formula. As we discussed during Week 3, researchers decide to ask 4 tie-purchasing customers whether they bought a bow tie or normal tie. According to national data, 3% of all ties purchased are bow ties. Not surprisingly, this problem can be easily framed as a Binomial Distribution problem, as it meets all of the conditions outlined in our Week 4 (Monday) class. Further, we can identify the purchase of a bow...
(Python or C++) We are going to implement the following scheduling algorithms that we discussed in...
(Python or C++) We are going to implement the following scheduling algorithms that we discussed in class: 1. First-Come First-Served (FCFS) 2. Shortest Remaining Time First (SRTF) 3. Highest Response Ratio Next (HRRN) 4. Round Robin, with different quantum values (RR) We are interested to compute the following metrics, for each experiment: _ The average turnaround time _ The total throughput (number of processes done per unit time) _ The CPU utilization _ The average number of processes in the...
In C programming using C11 library, how can we validate command line arguments? meaning for example...
In C programming using C11 library, how can we validate command line arguments? meaning for example if we input "./math 65 45 2.3 1 0 68" into the terminal, how can we validate that the numbers "65 45 2.3 1 0 68" are floats and not chars? In other terms the program should display and error message if the command line arguments are not floats and if they are floats, the program carries on as usual.
Consider the Mundell-Fleming model we have discussed in class for the small open economy. Suppose that...
Consider the Mundell-Fleming model we have discussed in class for the small open economy. Suppose that higher income implies higher imports and thus lower net exports. That is, the net-exports function is NX = NX(e, Y ) Examine the effects in a small open economy of a fiscal expansion on income and the trade balance under the following exchange-rate regimes: 1. A floating exchange rate (5 points) 2. A fixed exchange rate (5 points)
C Program: Write your own stringLength function (without calling a pre-written library function) that returns the...
C Program: Write your own stringLength function (without calling a pre-written library function) that returns the length of the string argument in characters, not including the terminating ‘\0’ character.   Write four versions of a void printString function (i.e., printString1, printString2, etc) each of which prints its string argument character-by-character but using the following techniques: printString1: array indexing printString2: pointer/offset with the array name as a pointer, printString3: pointer indexing, and printString4: pointer/offset with a pointer Write a void function called...
Keeping in mind what we discussed for the rotation about the C-C bond in ethane, identify...
Keeping in mind what we discussed for the rotation about the C-C bond in ethane, identify which of these bonds in the backbone of a protein possibly experience rotation. (peptide bond, φ, or ψ). Any bonds that have free rotation discuss if all possible angles would occur in proteins (why or why not?). Any bonds that do not experience rotation explain why?
Create a program that translates English into Pig Latin. The function will take the first letter...
Create a program that translates English into Pig Latin. The function will take the first letter of each word in the sentence only if it’s a not a vowel, and place it at the end of the word followed by “ay”. Your program must be case ​ins​ ensitive. You must write the functiontranslate() ​that takes in a single English word and ​returns​ its Pig Latin translation. Remembertranslatemusttake​onlyonewordasinput.​ ############################################################# # translate() takes a single english word translates it to #pig latin...
-Write in C++ -Use Char library functions Write a function that accepts a string representing password...
-Write in C++ -Use Char library functions Write a function that accepts a string representing password and determines whether the string is a valid password. A valid password as the following properties: 1. At least 8 characters long 2. Has at least one upper case letter 3. Has at least one lower case letter 4. Has at least one digit 5. Has at least on special character
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT