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

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...
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...
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)
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
MUST BE DONE IN C (NOT C++) In this task, using a function, we will add...
MUST BE DONE IN C (NOT C++) In this task, using a function, we will add a range of values of an array. The range will be determined by the user. For example, if I have the following array … 1.5 -5.6 8.9 4.6 7.8 995.1 45.1 -5964.2 … and the user tells me to add from the 3rd element to the 6th element, my program would add the values 8.9, 4.6, 7.8 and 995.1. To do so, please follow...
Use python write a function that translates the input string into Pig Latin. The translation should...
Use python write a function that translates the input string into Pig Latin. The translation should be done word by word, where all words will be separated by only one space. You may assume that each word must have at least one vowel (a,e,i,o,u and uppercased counterparts), and there will be no punctuation or other special characters in the input string. The Pig Latin rules are as follows: For words that begin with consonants, all letters before the initial vowel...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT