Correct me if I am wrong but Spark does not use JNI for Python. It uses py4j to allow Python programs to access Java Objects. All the core functionality is implemented in Scala&#x2F;Java. py4j uses sockets to communicate. See <a href="https:&#x2F;&#x2F;www.py4j.org&#x2F;about.html" rel="nofollow">https:&#x2F;&#x2F;www.py4j.org&#x2F;about.html</a>