Petitioners, prisoners at the Oregon State Penitentiary (OSP) and the Oregon State Correctional Institution (OSCI), appeal, pursuant to ORS 34.710, from an order dismissing consolidated amended petitions for writs of habeas corpus.1 The trial court granted defendants’ amended motions to dismiss, finding that it lacked subject matter jurisdiction over petitioners’ challenges to conditions of confinement because they have alternative legal remedies, ORCP 21A(1), and because there is another action pending in federal court between the same parties. ORCP 21A(3). We affirm.
The petitions were filed pursuant to ORS 34.310, which provides in part:
“Every person imprisoned or otherwise restrained of his liberty, within the state, exceptin the cases specified in ORS 34.330, may prosecute a writ of habeas corpus to inquire into the cause of such imprisonment or restraint, and if illegal, to be delivered therefrom.”
The petitions allege three claims for relief which deal solely with petitioners’ rights to be free from immediate and irreparable bodily harm in violation of their rights under the Oregon Constitution. The first claim concerns conditions of confinement and alleges that:
“1. The [correctional facilities] are excessively overcrowded * * *”
“2. The [correctional staff] is inadequately trained and supervised. They have displayed intemperate and violent behavior * * * in the past and are likely to continue such behavior.”2
*298The second claim incorporates the quoted allegations of the first claim and then alleges that petitioners have been treated with unnecessary rigor in violation of Article I, section 13, of the Oregon Constitution.3 The third claim is that the conditions alleged in the first claim amount to a “further restraint” in violation of Article III, section 1, of the Oregon Constitution4 and that those conditions require immediate judicial attention.
The trial court granted defendants’ motions5 to dismiss, finding:
“1. There is another action pending between these parties; and
“2. The court lacks habeas corpus jurisdiction because petitioners challenge conditions of confinement and have alternative legal remedies including injunctions, mandamus and civil suit.”
The gist of petitioners’ argument is that it cannot be determined on the basis of the record that there is another action pending between the parties and that the fact that there may or may not be alternative remedies is irrelevant to a proper analysis of their habeas corpus claims. We turn to the issue of subject matter jurisdiction.
When a petitioner is a prisoner by virtue of a valid judgment of conviction, the writ may be used to challenge the legality of additional measures of “imprisonment or restraint” beyond the initial restraint by imprisonment in a penal *299institution itself. Penrod/Brown v. Cupp, 283 Or 21, 24, 581 P2d 934 (1978). Specifically, the writ is available in two types of cases:
“(1) When a petition makes allegations which, if true, show that the prisoner, though validly in custody, is subjected to a further ‘imprisonment or restraint’ of his person that would be unlawful if not justified to the court, and (2) when a petition alleges other deprivations of a prisoner’s legal rights of a kind which, if true, would require immediate judicial scrutiny, if it also appears to the court that no other timely remedy is available to the prisoner.” 283 Or at 28.
The first type of claim has been characterized as a “prison within a prison.” Penrod/Brown v. Cupp, supra, 283 Or at 25 (prisoner in segregation and isolation); Peters v. Renfro, 43 Or App 411, 602 P2d 1137 (1979) (adult prisoner in juvenile section of jail). That type of claim is consistent with the traditional function of a writ of habeas corpus, and no showing of an immediacy of harm and inadequacy of other remedies is necessary. Penrod/Brown v. Cupp, supra. The second type of claim concerns allegations of unlawful conditions of imprisonment. The court has jurisdiction to hear those claims only on a showing that they “require immediate judicial scrutiny, if it also appears to the court that no other timely remedy is available to the prisoner.” Penrod/Brown v. Cupp, supra, 238 Or at 28.
Petitioners concede that their first and second claims concern conditions of imprisonment and that they are Penrod type 2 claims. The third claim, that the Corrections Division exercises “additional restraint” by incarcerating them in overcrowded conditions in violation of Article III, section 1, is framed as a Penrod type 1 claim concededly to avoid a necessity of showing immediacy of harm and lack of alternative remedies. Petitioners’ invocation of Article III, section 1, does not change an allegation of overcrowding from a condition of imprisonment to a further restraint.
In Penrod/Brown v. Cupp, supra, the court said:
“For instance, given access to other remedies, habeas corpus normally should not be needed to challenge overcrowding, the quality of prison food, the opportunities for recreation or exercise, or similar conditions of imprisonment even when the challenge has merit. Whether the legal remedies opened to prisoners by ORS 137.275, or administrative remedies that *300may be developed, will be adequate for any given class of claims cannot be decided in the abstract. Arguably a tort action, if not precluded by rules of immunity or other factors, may sometimes be an adequate remedy for a single assault, but it is not a remedy against a systematic employment of the threat or use of physical abuse. Equity provides the flexible remedy of injunction for conditions found to be contrary to law, and temporary restraining orders, if timely available to petitioners when needed, may obviate the need for habeas corpus where that need rests only on speed. Other forms of effective and speedy independent inquiry outside the courts could be imagined.” 283 Or at 27.
When the petition alleges unlawful conditions of confinement,
“[t]he petitioner must show (1) a need for immediate judicial attention either because of the ‘urgency of the harm to which the petitioner claims to be exposed or * * * [judicial scrutiny] is found to be required as a matter of constitutional law’, and (2) the lack of any other adequate and timely remedy. Penrod/Brown v. Cupp, supra, at 28.” Mueller v. Cupp, 45 Or App 495, 498, 608 P2d 1203 (1980).
Defendants acknowledge that the allegations of the petition do raise issues which, if true, may entitle petitioners to some form of judicial relief. They argue, however, that other sufficient and timely civil remedies include 42 USC § 1983, ORS 30.260-300 (Tort Actions Against Public Bodies) and ORS 28.010-160 (Declaratory Judgment), and that certain administrative remedies provide petitioners with a grievance procedure for their claims. OAR 291-109-005 - OAR 291-40-015. The trial court found that petitioners have alternative remedies, including injunction, mandamus and civil suit. Mandamus is not ordinarily an adequate alternative remedy. Mueller v. Cupp, supra, 45 Or App at 499. A tort action would not provide the prospective relief from overcrowding that petitioners are seeking. However, prison administrative grievance procedures are available. Similarly, an injunction can be a timely and successful remedy for unconstitutional prison conditions. Sterling v. Cupp, 290 Or 611, 625 P2d 123 (1981); see Note, Complex Enforcement: Unconstitutional Prison Conditions, 94 Harv L Rev 626 (1981).
Petitioners do not contend that there are no other alternative remedies. They argue instead that the trial court *301“must clearly set forth actual remedies readily available to the petitioners that would address the complaints alleged.” (Emphasis in original.) It appears to be petitioners’ argument that the trial court must make specific findings of what other alternative remedies are available. That is not correct. The trial court found, as a matter of law, that alternative remedies are available. That is adequate.
We hold that petitioners have not alleged facts that demonstrate a need for immediate judicial intervention because of the harm to which they claim to be exposed.6
Affirmed.
On August 20,1980, Bailey and others filed petitions for writs of habeas corpus, naming Sullivan, the Superintendent of OSCI, and Watson, the Administrator of the State Corrections Division, as defendants. On August 21,1980, Armstrong and others filed similar petitions naming Cupp, the Superintendent of OSP, as defendant. Over the next several months similar petitions were filed by 252 inmates at OSCI and 107 inmates at OSP. After counsel were appointed, amended petitions were filed. The petitions were then consolidated at trial for pleading and argument. There is no amended petition in the Armstrong trial court case file, although petitioners have included a copy of the amended petition in the appendix to their brief. The parties have proceeded on the basis that an amended petition was filed, and we have conducted our review accordingly.
The petition in the Armstrong case alleged a third condition, that plaintiffs were “denied fair and equal access to existing institutional programs” to their mental, moral and physical detriment. Petitoners have not argued or addressed that condition of confinement on appeal.
Article I, section 13, provides:
“No person arrested, or- confined in jail, shall be treated with unnecessary rigor.”
Article III, section 1, provides:
“The powers of the Government shall be divided into three seperate [sic] departments, the Legislative, the Executive, including the administrative, and the Judicial; and no person charged with official duties under one of these departments, shall exercise any of the functions of another, except as in this Constitution expressly provided.”
Annexed to the motions are the findings and conclusions, opinion and order of the U.S. District Court for Oregon in West v. Atiyeh, civil case number 80-6014, which concerns claims of unconstitutional overcrowding at OSCI under the Eighth Amendment to the U.S. Constitution. Defendants state that petitioners are also class members in that district court action.
Because we hold that the trial court correctly dismissed the petition for lack of subject matter jurisdiction, we need not address the alternative reason for dismissing the action, that another action is pending between these parties.